Wikisage, the free encyclopedia of the second generation and digital heritage, wishes you merry holidays and a happy new year!

Template:Str left

From Wikisage
Jump to navigation Jump to search
Template description
Purpose

This template removes leading whitespace from a string and then trims it at the end.

Use

{{Str left|<string>|<count>}}

Gives the resultant <count> of characters creating a substring of characters from the start of the trimmed string (i.e. the substring returned will have length <count>, exclusive of leading whitespace characters, which are trimmed first before <count> is invoked).

If <count> is invalid, empty or zero, an empty string is returned. If undefined, it defaults to 1.

Note: only 500 characters can be extracted even if the <string> is longer. The maximum substring stops at 500 long, but gives no error message.

Example

{{ Str left |     Lorem ipsum dolor sit amet | 10 }} → Lorem ipsu