1. Regex
C#regex is a regular expression class
Used for string processing to find a matching string.
By further exploring the use of regular expressions, I learned the following usage:
(? = subexpression): 0 width Positive lookahead assertion. The match continues only if the subexpression matches the right side of this position. For example, 19 (? =99) matches the 19 instance that precedes 99.
(?! sub-expression): 0 width Negative lookahead assertion. The match continues only if the sub-expression does not match to the right of the position. For example, (?! 99) matches a word that does not end with 99, so it does not match 1999.
(? <= sub-expression): 0 width is being recalled after the assertion is issued. The sub-expression continues to match only if the subexpression matches the left side of this position. For example, (? <=19) 99 matches an instance of 99 followed by 19. This construct does not backtrack.
(? <! sub-expression): 0 width negative review post assertion. The match continues only if the subexpression does not match to the left of this position. For example (? <!19) matches a word that does not start with 19, so it does not match 1999.
The program implemented is:
Output Result:
2. How to get the time
The implemented method to get the current time is:
If extended to weeks, it should be:
3. Int. TryParse () and Int. The difference between Parse ():
After the output test, the experience can be collated:
Int. TryParse () and Int. Parse () can only be an integer string type (that is, after the various integer tostring () and cannot be a floating-point type
otherwise int. Parse () will appear with an incorrect string format for the input int. TryParse () also returns false with an output parameter of 0)
and (int) can only be a numeric type (example Float,int,uint, etc.);
C # (5)--Regular Expression class