Template:Str right
Revision as of 03:47, 29 June 2022 by Naginreed (talk | contribs) (Created page with "<includeonly>{{{{{|safesubst:}}}#ifexpr: {{{2|0}}} < 0 |{{{1}}} |{{{{{|safesubst:}}}#ifexpr: {{{2|0}}}+1 > {{{{{|safesubst:}}}#invoke:String|len|s={{{1}}}}} | | {{{{{|safesubst:}}}#invoke:String|sub|s={{{1}}}|{{{{{|safesubst:}}}#expr:{{{2|0}}}+1}}|nocategory={{{nocategory|}}}}} }} }}</includeonly> <noinclude> {{doc}} Category:Formatting templates </noinclude>")
Usage
{{Str right|<string>|<offset>}}
Gives the characters from <offset> to the end of the string.
A negative <offset> is treated the same as zero, which simply returns the original string.
If <offset> is longer than <string> then this returns an empty string.
If <offset> is invalid, empty or undefined, this template goes berserk, so don't do that.
Limitations
- Up to 100 chararacters in the input string. If possible, first check length of input string using
{{Str len}}
. Using strings longer than 100 characters may result in the error "max index is 100 for str_sub". - Limited set of characters.
- Expensive.
Examples
- {{Str right| lorem ipsum dolor sit amet | 10 }} → m dolor sit amet
- {{Str right| lorem ipsum dolor sit amet | 1 }} → orem ipsum dolor sit amet
- {{Str right| lorem ipsum dolor sit amet | 0 }} → lorem ipsum dolor sit amet
The above documentation is transcluded from Template:Str right/doc. (edit | history)