15.3.1
The split method of string accepts a regular expression, and the rule expression Basic mountain consists of two characters: literal meaning characters (literals) and metacharacters (metacharacters), metacharacters have special meanings in regular expressions, and to compare these characters must be omitted. In Java, to compose a rule representation in "" is different from the direct write rule expression, which generally needs to be prefixed with a \ symbol.
Multiple characters are grouped together to be a character class placed in [], some commonly used character classes do not have to be placed in [], to become a predefined character class, character classes need to use the multi-query API
See greedy quantifiers, the comparator will be the remainder of the text eaten, and then gradually spit out, the result is greedy quantifiers will try to find the longest length of the text in the greedy quantifier after adding? will become a gradual quantifier, the gradual quantifier will be as far as possible to find the shortest length of the matching text
After greedy quantifiers Plus + will become a degree of spit quantifiers, comparator saw the word will first eat the remaining words, and then see if the words of the single-spit measure is in line with the text to eat, if met will not spit out
ReplaceAll will replace the string that matches the rule expression and return the new string
\b can be used to mark boundary boundary comparisons to indicate that the text must conform to a specified boundary condition, that is, an anchor point, or that it can be called an anchored point (Anchor) to group the rule representation, and to use a quantifier
15.3.2Pattern and Matcher
Pattern instances must be obtained through the static method compile of the pattern
After you get the pattern instance, you can use the split () method to cut the specified string, similar to the split () method of String, Matcher also has the ReplaceAll () method, similar to the ReplaceAll () method of String
15.4jdk8api new features 15.4.1StringJoiner Arrarys
The join method of string can be used to concatenate strings, and the arrays class also adds some overloaded methods
15.4.2Stream
The range method of stream can produce an integer range, and the Java.util.Random class can be used to generate random numbers