删除字符串
package HelloPackage
import scala.io.StdIn
object DeleteStr {
def main(args: Array[String]): Unit = {
var str1 = ""
var str2 = ""
var i = 0
var j = 0
var flag = 0
print("请输入第一个字符串:")
str1 = StdIn.readLine()
print("请输入第二个字符串:")
str2 = StdIn.readLine()
for (i <- 0 to str1.length-1){
j = 0
flag = 0
for (j <- 0 to str2.length-1){
if (str1.charAt(i).equals( str2.charAt(j) ) ){
flag = 1
}
}
if (flag == 0){
print(str1.charAt(i))
}
}
}
}
创建scala项目
虚拟机中配置项目架构