Difference between revisions of "Template:Str right/doc"
From Ava Zinn Wiki
[unchecked revision] | [unchecked revision] |
(indented Usage line; noted zero gets entire string; limit of 50 else may get message "max index is 50 for str_sub"; put example for 0 as "lorem all with zero"; put See-also text describing each link) |
(Restore appearance like documentation pages of similar templates. Remove superfluous, technical, or repeated parts.) |
||
Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> | <!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE --> | ||
− | + | ||
=== Usage === | === Usage === | ||
− | + | : <code>{{Tlx|Str right|<string>|<offset>}}</code> | |
− | Gives the characters from <offset> to the end of the | + | Gives the characters from <offset> to the end of the string. |
− | If <count> is invalid, empty or undefined, this template goes berserk | + | If <count> is invalid, empty or undefined, this template goes berserk, so don't do that. |
=== Limitations === | === Limitations === | ||
− | * Up to 50 chararacters in the input string. Longer strings will cause an error message. If possible, first check length of input string using {{ | + | * Up to 50 chararacters in the input string. Longer strings will cause an error message. If possible, first check length of input string using {{Tl|Str len|<string>}}. Using <offset> over 50, can give the error '''''"<font color=#CC1100>max index is 50 for str_sub</font>"''''', so the input string should not have over 50 characters. |
* Limited set of characters, perhaps. | * Limited set of characters, perhaps. | ||
− | * Expensive | + | * Expensive. |
=== Examples === | === Examples === | ||
Line 20: | Line 20: | ||
*<tt><nowiki>{{Str right| lorem ipsum dolor sit amet | 1 }}</nowiki></tt> → {{Str right| lorem ipsum dolor sit amet | 1 }} | *<tt><nowiki>{{Str right| lorem ipsum dolor sit amet | 1 }}</nowiki></tt> → {{Str right| lorem ipsum dolor sit amet | 1 }} | ||
*<tt><nowiki>{{Str right| lorem all with zero. | 0 }}</nowiki></tt> → {{Str right| lorem all with zero. | 0 }} | *<tt><nowiki>{{Str right| lorem all with zero. | 0 }}</nowiki></tt> → {{Str right| lorem all with zero. | 0 }} | ||
− | |||
− | |||
− | |||
=== See also === | === See also === | ||
− | * {{ | + | * {{Tl|Trunc|<string>|<count>}} - truncate right-side of string |
− | * {{ | + | * {{Tl|Str left|<string>|<count>}} - extract left-side substring |
− | * {{ | + | * {{Tl|Str rightc|<string>|<count>}} - extract right-side of string |
− | * {{ | + | * {{Tl|Str len|<string>}} - get numeric length of string (can be over 300 long) |
− | |||
<includeonly> | <includeonly> |
Revision as of 11:18, 11 October 2009
This is a documentation subpage for Template:Str right. It contains usage information, categories and other content that is not part of the original template page. |
Contents
Usage
-
<code>{{Str right|<string>|<offset>}}
</code>
Gives the characters from <offset> to the end of the string.
If <count> is invalid, empty or undefined, this template goes berserk, so don't do that.
Limitations
- Up to 50 chararacters in the input string. Longer strings will cause an error message. If possible, first check length of input string using {{Str len}}. Using <offset> over 50, can give the error "max index is 50 for str_sub", so the input string should not have over 50 characters.
- Limited set of characters, perhaps.
- Expensive.
Examples
- {{Str right| lorem ipsum dolor sit amet | 10 }} → Expression error: Unrecognized punctuation character "{".
- {{Str right| lorem ipsum dolor sit amet | 1 }} → Expression error: Unrecognized punctuation character "{".
- {{Str right| lorem all with zero. | 0 }} → Expression error: Unrecognized punctuation character "{".
See also
- {{Trunc}} - truncate right-side of string
- {{Str left}} - extract left-side substring
- {{Str rightc}} - extract right-side of string
- {{Str len}} - get numeric length of string (can be over 300 long)