Changes
allow template to round and format usage count
{{Documentation subpage}}
{{High-use|10999}}
{{Lua|Module:String}}
<!----PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE---->
===Usage===
<nowiki>{{str index|</nowiki>''text''|''number''<nowiki>}}</nowiki> = Returns the ''number''-th character of ''text''.
Base 1: the first character is numbered 1, and so on. Any leading or trailing whitespace is removed from the string before searching.
If the requested position is negative, this function will search the string counting from the last character. In other words,
number = -1 is the same as asking for the last character of the string.
A requested position equal to zero or with a value longer than the string will generate an error.
This function will properly return a space character (' ') if the selected position contains a space.
===Examples===
* <code>{{tlp|str index|0123456789ABCDEF|0}}</code> → {{str index|0123456789ABCDEF|0}}
* <code>{{tlp|str index|0123456789ABCDEF|1}}</code> → {{str index|0123456789ABCDEF|1}}
* <code>{{tlp|str index|0123456789ABCDEF|15}}</code> → {{str index|0123456789ABCDEF|15}}
* <code>{{tlp|str index|0123456789ABCDEF|18}}</code> → {{str index|0123456789ABCDEF|18 |nocategory=true}}
===See also===
{{String-handling templates |trim}}
<includeonly>
<!----CATEGORIES BELOW THIS LINE, PLEASE:---->
{{#ifeq:{{SUBPAGENAME}}|sandbox | |
[[Category:String manipulation templates]]
}}
</includeonly>
{{High-use|10999}}
{{Lua|Module:String}}
<!----PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE---->
===Usage===
<nowiki>{{str index|</nowiki>''text''|''number''<nowiki>}}</nowiki> = Returns the ''number''-th character of ''text''.
Base 1: the first character is numbered 1, and so on. Any leading or trailing whitespace is removed from the string before searching.
If the requested position is negative, this function will search the string counting from the last character. In other words,
number = -1 is the same as asking for the last character of the string.
A requested position equal to zero or with a value longer than the string will generate an error.
This function will properly return a space character (' ') if the selected position contains a space.
===Examples===
* <code>{{tlp|str index|0123456789ABCDEF|0}}</code> → {{str index|0123456789ABCDEF|0}}
* <code>{{tlp|str index|0123456789ABCDEF|1}}</code> → {{str index|0123456789ABCDEF|1}}
* <code>{{tlp|str index|0123456789ABCDEF|15}}</code> → {{str index|0123456789ABCDEF|15}}
* <code>{{tlp|str index|0123456789ABCDEF|18}}</code> → {{str index|0123456789ABCDEF|18 |nocategory=true}}
===See also===
{{String-handling templates |trim}}
<includeonly>
<!----CATEGORIES BELOW THIS LINE, PLEASE:---->
{{#ifeq:{{SUBPAGENAME}}|sandbox | |
[[Category:String manipulation templates]]
}}
</includeonly>