A string can contain any character from the Unicode Character Set. Common methods and notes for string application:
1. The character string without any character is a null string (""), and the character string indicating space is ("").
2. Common Methods:
From string to array, a string is decomposed into a series of segments, and these segments are put into a string array, split (char [] delimeter, int L ); the first parameter must appear as a char array, and the first element of the array is a character used as a separator.
Programming string from string array: Join Method
Several Methods for comparing strings: s1.equal (string S2): Return bool value; s1.compareto (S2): Return-, 1; string. compare (S1, S2): return value is the same as compareto;
Others include intercepting the substring () of a string, case-insensitive conversion method, and inserting method insert.
Difference between string and stringbuilder: the string class object remains unchanged. Each time a new object is generated to save the value, stringbuilder is variable and the most primitive value is changed. stringbuilder hasChars array attributesThis attribute returns the characters at the specified position in the parameter, and sets the characters to be passed as parameters.
Regular Expression: a regular expression is a string defined for other string search modes. If you want to match, you generally need to use the match class. The match class provides a method to store data that matches regular expressions.
Regular Expressions match words but do not match spaces.
Several common symbols of a regular expression:
Quantifiers:
+: Indicates that the regular expression matches one or more characters that follow the regular expression;
*: Indicates that the regular expression must match zero or multiple characters in the regular expression;
? : Matches zero or one quantizer;
{}:{ N}: Match n times; {n, m}: Match n times, Max. m times. N is the minimum value, and m is the maximum value;
Use character classes (three common ):
Period (.): wildcard;
Square brackets []: Match character groups
Escape Character (^): indicates the inverse of the matching character class or the negative (not) of the character class );
Assertions:
1. Composed of delimiters (^), indicating that regular expressions can only start matching at the beginning of a string or line;
2. It is composed of dollar signs ($), indicating that regular expressions can only start matching at the end of a string or line;
3. "\ B" indicates that matching can only happen at the beginning or end of a word separated by spaces.
Group structure:
Anonymous group and naming Group
Zero-width forward pre-search assertion and zero-width reverse pre-search assertion
Format:
Zero-width forward pre-search assertion: Forward right or reverse right search
Zero-width reverse pre-search assertion: Forward left or reverse left search