Wiktenauer logo.png

Template:Trunc

From Wiktenauer
Revision as of 02:29, 23 September 2012 by Michael Chidester (talk | contribs) (1 revision)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
[edit] [history] [purge] Documentation icon Template documentation

Usage

{{Trunc|<string>|<count>}}

Gives the <count> characters from the start of the string.

If <count> is invalid, empty or undefined, it just returns the string.

Examples

  • {{Trunc | Lorem ipsum dolor sit amet | 10 }} → Lorem ipsu
  • {{Trunc | Lorem ipsum dolor sit amet | 1 }} → L
  • {{Trunc | Lorem ipsum dolor sit amet | 0 }}
  • {{Trunc | Lorem ipsum dolor sit amet | }} → Lorem ipsum dolor sit amet
  • {{Trunc | Lorem ipsum dolor sit amet }} → Lorem ipsum dolor sit amet
  • {{Trunc | Lorem ipsum dolor sit amet | foo }} → Lorem ipsum dolor sit amet
  • {{Trunc | Lorem ipsum dolor sit amet | 40 }} → Lorem ipsum dolor sit ametLorem ipsum do

See also

  • {{Str left}} - which is almost identical.
  • {{Str right}} - extract remainder of string
  • {{Str rightc}} - extract right-side of string
  • {{Str len}} - get numeric length of string (can be over 300 long)