Index (primary string, substring) starts from 0 and returns the position of the most recent substring in the primary string.
Rindex (Main string, sub-string) Searches from the end and returns the position of the most recent sub-string in the main string.
You can accept the third parameter, indicating that the user starts searching. The default value is from 0 or the last
Substr operation substring
Three parameters: a string, an initial value from scratch, and the length of the sub-string returned value is a sub-string
If the second parameter is a negative value, it is the number starting from the end. The first parameter at the end is-1, followed by-2 to the left,-3...
If the third parameter is omitted, it starts from the second parameter to the end of the string.
Substr ($ big, 0, 5) = "zhouxiang" to perform this operation will change the original string.
Only the part of the string can be operated.
You can also take the part to be assigned as the fourth parameter to achieve the same effect.
Sprintf and printf have the same parameters, but sprintf returns the string to be requested instead of outputting it
Advanced sorting
Similar to the compareable interface in Java
You only need to specify the order relationship between the two elements to be sorted.
$ A <$ B-1
$ A> $ B 1
$ A = $ B, $ A and $ B do not distinguish size 0
Usage
Sort subroutine data
Note: Generally, child routines are named _.
Shorthand
Compare the number spacecraft operator <=> and return-1, 0, 1.
String CMP