import scala.collection.mutable.ListBuffer
val test_hash = new collection.mutable.HashSet[String]()
test_hash.add("123")
test_hash.add("126")
test_hash.add("125")
test_hash.add("124")
val list_test = new ListBuffer[String]()
if(test_hash.contains("123")){
list_test.append("TTT")
}else{
println("FFF")
}
println(list_test)
// 去除字符串前后空格
val str = " hello "
println(str.trim) //hello
scala中去除字符串前后空格API---trim,自定义hashset用来存储元素作为查找是否存在
最新推荐文章于 2022-11-10 22:11:29 发布