Template:Str left
Jump to navigation
Jump to search
[edit] [ ] Template documentation
This documentation is transcluded from Template:Str left/doc. (edit | history)
Editors can experiment in this template's sandbox (create) and test cases (create) pages.
Subpages of this template.
Editors can experiment in this template's sandbox (create) and test cases (create) pages.
Subpages of this template.
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}}
→
- like
- if undefined, count defaults to 1
- like
{{Str left|example}}
→ e
- like
- 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
,<nowiki />
, 
,<!-- HTML comments -->
are problematic; see Wikipedia for details
- things like