String s1 = "abcd";
String s2 = new String("ab cd");
//System.out.println(s1 == s2);
Returns the index for the 1 value, spaces are also considered
char c=s1.charAt(1);
System.out.println(c);
Contains
System.out.println(s1.contains("b"));
Whether it is xxx ending
System.out.println(s1.endsWith("c"));
The s into byte array
byte [] b=s1.getBytes();
for (byte d : b) {
System.out.println(d);
}
splice
System.out.println(s1.concat("aaaaaa"));
Returns the character in s appear first position
System.out.println(s1.indexOf(98));
System.out.println(s1.indexOf("c"));
//s1.intern();
System.out.println("---------------------");
Returns character index within this string of the last occurrence.
System.out.println(s1.lastIndexOf("a"));
length
System.out.println(s1.length());
replace
System.out.println(s1.replace("a", "b"));
Packet classification
String[] arr=s2.split(" ");
for (String bb : arr) {
System.out.println(bb);
}
Whether it is xx beginning
System.out.println(s1.startsWith("aa"));
Interception
System.out.println(s1.substring(2));
String variable group
char ccc[]= s1.toCharArray();
for (char d : ccc) {
System.out.println(d);
}
Variable capital
System.out.println(s1.toUpperCase());
Turn into a String
System.out.println(String.valueOf(false));