Java的String Arraylist及Hash

String

Nature

The underlying nature of String is char[], for example, String str="abc", which is equivalent to char[] arr = {'a','b','c'};
There are two forms of creating objects: String str = "abc", And String str2 = new String("abc");

Common method

  • trim: delete the spaces at both ends of the string
  • length: Get the length of the string;
  • equals: Determine whether the strings are the same, case sensitive;
  • equalsIgnorcCase: Determine whether the string length is the same, ignoring case;
  • indexOf: Get the position where the specified content appears in the string
  • replace: replace
  • split cutting
  • substring: self-division interception
public class OperationString {
   
    
    

	public static void main(String

Guess you like

Origin blog.csdn.net/Mwyldnje2003/article/details/106976128