ಟೆಂಪ್ಲೇಟ್:Str index/doc
This is a documentation subpage for ಟೆಂಪ್ಲೇಟ್:Str index. It may contain usage information, categories and other content that is not part of the original ಟೆಂಪ್ಲೇಟ್ page. |
This template is used on approximately ೧೨,೦೦೦ pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
This template uses Lua: |
Usage
ಸಂಪೊಲಿಪುಲೆ{{str index|text|number}} = 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
ಸಂಪೊಲಿಪುಲೆ{{str index|0123456789ABCDEF|0}}
→ String Module Error: String index out of range{{str index|0123456789ABCDEF|1}}
→ 0{{str index|0123456789ABCDEF|15}}
→ E{{str index|0123456789ABCDEF|18}}
→ String Module Error: String index out of range
See also
ಸಂಪೊಲಿಪುಲೆಟೆಂಪ್ಲೇಟ್:String-handling templates