String类的常用方法:
public int length() //返回字符串长度
String s = "12345";
System.out.println(s.length()); //5
public int length() //返回字符串长度
String s = "12345";
System.out.println(s.length()); //5
String s1 = "12345";
String s2 = "54321";
System.out.println(s1.equals(s2)); // false
知识兔String s = "12345";
System.out.println(s.substring(2)); //"345"
知识兔String s = "12345";
System.out.println(s.substring(2,4)); //"34"
知识兔String s = "12345";
System.out.println(s.charAt(2)); //3
知识兔String s = "12345";
System.out.println(s.indexOf("34")); //2
知识兔String s1 = "12345";
String s2 = "1234567";
System.out.println(s1.compareTo(s2)); //-2
知识兔String s = "12345";
System.out.println(s.replace('2', '6')); //16345
知识兔String s = " 1234 5 ";
System.out.println(s.trim()); //1234 5
知识兔String s = "ABcd";
System.out.println(s.toLowerCase()); //abcd
System.out.println(s.toUpperCase()); //ABCD
知识兔