Template:Str left/doc: Difference between revisions
Template page
More actions
Equivalent to Template:Trunc. One is superior to the other - which? |
updated documentation, from {{trunc}} |
||
| 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 --> | ||
This template returns a certain number of characters from the start of a text string. | |||
=== Usage === | |||
*'''first parameter''' ''(compulsory)'' the text string to truncate | |||
*'''second parameter''' the number of characters to return. If invalid or empty, an empty string is returned. If undefined, it defaults to 1. | |||
===Examples=== | |||
*<tt><nowiki>{{Str left| lorem ipsum dolor sit amet | 10 }}</nowiki></tt> → {{Str left| lorem ipsum dolor sit amet | 10 }} | |||
*<tt><nowiki>{{Str left| lorem ipsum dolor sit amet | 1 }}</nowiki></tt> → {{Str left| lorem ipsum dolor sit amet | 1 }} | |||
*<tt><nowiki>{{Str left| lorem ipsum dolor sit amet | foo }}</nowiki></tt> → {{Str left| lorem ipsum dolor sit amet | foo }} | |||
*<tt><nowiki>{{Str left| lorem ipsum dolor sit amet | }}</nowiki></tt> → {{Str left| lorem ipsum dolor sit amet | }} | |||
*<tt><nowiki>{{Str left| lorem ipsum dolor sit amet }}</nowiki></tt> → {{Str left| lorem ipsum dolor sit amet }} | |||
=== See also === | |||
Equivalent to [[Template:Trunc]]. One is superior to the other - which? | Equivalent to [[Template:Trunc]]. One is superior to the other - which? | ||
<includeonly> | <includeonly> | ||
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS --> | <!-- CATEGORIES AND INTERWIKIS HERE, THANKS --> | ||
Revision as of 22:46, 13 May 2009
This template returns a certain number of characters from the start of a text string.
Usage
- first parameter (compulsory) the text string to truncate
- second parameter the number of characters to return. If invalid or empty, an empty string is returned. If undefined, it defaults to 1.
Examples
- {{Str left| lorem ipsum dolor sit amet | 10 }} → lorem ipsu
- {{Str left| lorem ipsum dolor sit amet | 1 }} → l
- {{Str left| lorem ipsum dolor sit amet | foo }} →
- {{Str left| lorem ipsum dolor sit amet | }} →
- {{Str left| lorem ipsum dolor sit amet }} → l
See also
Equivalent to Template:Trunc. One is superior to the other - which?