Template:Str sub
Appearance
Usage
{{str_sub|text|start|length}} = Substring of text starting at start and containing length characters. Base 0: the first character is numbered 0, and so on, e.g. {{str_sub|20090624130510|8|2}} returns the 2 characters starting at the 9th, i.e. "13"
start + length must be less than 50. Only operates on a limited character set.
See also
Trimming templates:
- {{Str left}} – To trim down to a specified number of characters, or duplicate the string to a specified number.
- {{Str trim}} — To trim any leading or trailing whitespace.
- {{Str right}} — To trim the first specified number of characters.
- {{Str rightc}} — To trim the first specified number of characters, returns a parameter if the string is empty.
- {{Str sub}} — To trim down to a specified number, starting at a given number from the left, less than 50.
- {{Str sub long}} — To trim down to a specified number, starting at a given number from the left, less than 100.
Analyzing templates:
- {{Str find}} – Returns the numerical location of a given string in a string, up to 50 characters.
- {{Str index}} – Returns a given character from a string, but not accented letters.
- {{Str index any}} – Returns a given character from a string, but not a space.
- {{Str len}} – Returns a string's length. Can count up to 500 characters.
String length comparison templates:
- {{Str ≥ len}} – To check if a string is "longer or equally long" or "shorter" than a given length.
- {{Str ≤ len}} – To check if a string is "shorter or equally long" or "longer" than a given length.
- {{Str ≠ len}} – To check if a string is "not equal" or "equal" to a given length.
- {{Str ≤ ≥ len}} – To check if a string is "shorter", "equal", or "longer" than a given length.