Template:Str left

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search
[edit] [purge] Template-info.svg Template documentation

Description

Extracts the first count characters from string. Leading whitespace is trimmed. Both of these examples return Lorem:

{{Str left|Lorem ipsum|5}}
{{Str left|            Lorem ipsum|5}}

Usage

{{Str left|string|count}}

There are several quirks to the usage:

  • if count is invalid, empty, or zero; an empty string is returned
    • like {{Str left|example|X}}
  • if undefined, count defaults to 1
    • like {{Str left|example}}e
  • maximum search length is 500, no error shown
    • attempting to extract 501 characters from a 501-character string returns 500 characters
  • non-text has issues
    • things like &nbsp;, <nowiki />, &#32;, <!-- HTML comments --> are problematic; see Wikipedia for details

Further reading