සැකිල්ල:Substr any
Appearance
The substring Template:Substr_any extracts a substring of any characters, including accented letters, for a specified offset and length.
Usage
[සංස්කරණය]- {{substr_any|text|offset|length}} = Substring of text starting at offset and containing length characters.
Offset from 0: the first character is numbered 0, and so on. The offset + length must be less than 50. Operates on an extended character set, including accented letters, if listed in Template:Str index/getchar.
Examples
[සංස්කරණය]- {{substr_any|ABCDEFÄÖÜ |5|2}} returns 2 letters "FÄ".
- {{substr_any|ABCDEFÄÖöÜüÑñß |8|4}} returns the 4 characters starting at the 9th, "öÜüÑ".
- {{substr_any|XYZÈèĖėÇç |5|10}} returns 4 letters "ĖėÇç" as too short for 10.
See also
[සංස්කරණය]Easy to use and efficient string length comparison templates:
- {{str ≥ len}} – To check if a string is "longer or equally long" vs. "shorter" than a given length.
- {{str ≤ len}} – To check if a string is "shorter or equally long" vs. "longer" than a given length.
- {{str ≠ len}} – To check if a string is "not equal" vs. "equal" to a given length.
- {{str ≤ ≥ len}} – To check all three of "shorter", "equal" and "longer" at the same time.
Much less efficient string length template:
- {{str len}} – Takes a string as parameter and returns its length. Can count up to 500 in length.
Technical stuff:
- mw:Help:Magic words – About
{{padleft:|}}
. - mw:Help:Extension:ParserFunctions – About
{{#ifeq:|||}}
etc.