// 字符串索引取值
var s = "";
System.out.println(s.charAt()); // 字符串比较
var s1 = "";
var s2 = "";
var s3 = ""; System.out.println(s1.compareTo(s2));
System.out.println(s1.compareTo(s3)); //字符串拼接
var s4 = "allaboutscala";
var s5 = ".org"; System.out.println(s4.concat(s5)); // 字符串前缀及后缀判断
var s6 = "www.kernel.org";
var s7 = "www";
var s8 = "org";
System.out.println(s6.startsWith(s7));
System.out.println(s6.endsWith(s8)); // 字符串拷贝
char[] s9 = {'','','',''};
var s10 = "abc"; s10.getChars(,,s9,);
System.out.println(s9);
//字符查找
System.out.println(s6.indexOf('w'));
System.out.println(s6.indexOf('w',)); System.out.println(s6.lastIndexOf('w')); System.out.println(s6.replace('w','W')); System.out.println(s6.length()); //字符串截取
System.out.println(s6.substring()); System.out.println(s6.substring(,)); System.out.println(s6.toUpperCase());
System.out.println(s6.toLowerCase()); System.out.println(s6.toCharArray());

output:


allaboutscala.org
true
true
ab34 - WWW.kernel.org kernel.org
ke
WWW.KERNEL.ORG
www.kernel.org
www.kernel.org
05-11 17:29