1.1.1 filter方法函数
scala>val m = "hello world ".filter(_!=l)测试
m : String = heo wordspa
注:filter 方法将字符串中的等于l的字符串均过滤掉。scala
1.1.2 测试字符串的相等性排序
scala>val s1 = "hello"字符串
scala>val s2 = "HELLO"方法
scala>s1 == s2filter
res0:Boolean = falseword
scala>s1.toUpperCase == s2.toUpperCaseco
res1:Boolean = true
scala>s1.equalsIgnoreCase(s2)
res2:Boolean = true
注:toUpperCase函数将字符串所有转换为大写进行排序。
equalsIgnoreCase函数忽略在字符串对比时的大小写差别。