Template:Str left/doc

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search
This is a documentation subpage for Template:Str left.
It contains usage information, categories and other content that is not part of the original template page.
To view the template page itself, see Template:Str left.

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