Template:Str left/doc
Jump to navigation
Jump to search
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