java-regular, the use of two methods in object

Regular: The dots "." and "\"
"." represent any character in a regular expression.
"\" is an escape character in regular expressions. When we need to describe a special character that has been used by regular expressions, we can convert it to its original meaning by using "\".
"\" also has some predefined special contents in regular expressions:
\d: means any number
\w: means any word character (only numbers, letters, underscores)
\s: means any blank character ( \t \r \n \f \x0B)
\D: Represents any non-digital character
\W: Represents any non-word character
\S: Represents any non-whitespace character
"Character set []" is used to describe a single character, The content of this character can be defined inside the square brackets, and it can also describe a range. (Official website: www.fhadmin.org) For example: [abc]: indicates that the character can only be a or b or c
[123]: indicates that the character can only be 1 or 2 or 3 When we need to describe all lowercase letters, We can use the range [az], which means that the character can be any lowercase letter.
You can also use [0-9] to indicate that the character can be any number.
You can also choose from multiple ranges. For example, [a-zA-Z0-9_] means that the character can be any letter, number, and "underscore".
"+": Indicates that the content can appear at least 1 time in a row
"*": Indicates that the content appears 0-several times
"?": Indicates that the content appears 0-1 times
{n}: Indicates that the content must appear n times
{n,

() The content can be regarded as a whole, and "|" can be used in () to indicate or relationship.
Regular expressions add "^" at the beginning and "$" at the end to indicate a whole, but in Java use the default matching whole.

1.1 One of the related methods for strings to support regular expressions,
boolean matches(String regec (official website: www.fhadmin.org))
uses a given regular expression to match whether the format of the current string satisfies the requirements of the regular expression. true, the regular expression passed in by the macthes method provided by String is all matched even if no boundary characters are
added . Partially split, store the split strings in an array and return them . If the split part is found to be consecutively matched during the splitting process, an empty string will be removed in the middle, but if there is a continuous match at the end of the string , the splitting of empty strings will be ignored . 1.3 The third regular expression method supported by String String replaceAll(String regex, String str) replaces the part of the current string that satisfies the regular expression with the given string  2.1 object The principle of overriding the tostring method Usually, when we need to use the toString method of an object, we should rewrite the method, because the method provided by the object returns the handle of the object: class name@address, so we can't get information about the object. The actual relevant information of beauty The string returned by tostring should contain the content (attribute value) of the current object. The specific format and content are determined according to the actual design requirements of the current class.









2.2 The equals method of object
The design purpose of the equals method is to compare whether the contents of two objects are consistent.
The comparison principle is: to compare the attribute values ​​of two objects, it is not necessarily required to say that there are attribute values ​​that are the same, depending on the design requirements of the current class. Certainly

 

I'm a beginner, if there is any bad update, welcome this great god to point out, thank you!

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326976104&siteId=291194637