1. Equals, compares string contents, case-sensitive
String S1 = "abc"; String s2 = "ABc"; System.out.println (s1.equals (S2)); --->false
2.equalsIgnoreCase, comparing string contents, case-insensitive
String S1 = "abc"; String s2 = "ABc"; System.out.println (s1.equalsignorecase (S2)); --->true
3.contains, whether the string contains and contains all, case-sensitive
String S1 = "ABCDEF"; String s2 = "F"; String S3 = "F"; System.out.println (S1.contains (S2)); --->truesystem.out.println (s1.contains (S3)); --->false
4.startsWith, determine string start value, case sensitive
String S1 = "ABCDEF"; System.out.println (S1.startswith ("A")); --->truesystem.out.println (s1.startswith ("B", 1)); --->truesystem.out.println (s1.endswith ("F")); --->false
5.isEmpty to determine if it is empty
String S1 = "ABCDEF"; System.out.println (S1.isempty ()); --->false
6.int Length ()
7.char charAt (int index) returns the character of the position from the string
8.int indexof (int ch) Returns the first occurrence of the index
9.int indexOf (String)
10.String subString (int start, (int end)) Intercept string
11.getBytes encoding, converting a string to a character array
String S1 = "ABCDEF"; byte[] arr =s1.getbytes (); for (int i=0;i<s1.length (); i++) {System.out.println (arr[i]);}
Convert a character array to a string
String s2= new String (arr); SYSTEM.OUT.PRINTLN (S2);
12.string replace (char old, char new)
13.string Replace (string old, string new)
14.trim ()
... Not a list of
Java Foundation _string