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

Gives the <count> substring of characters from the start of the string (the substring has length <count>).

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

Limitations

editar
  • Length to 500: The maximum substring stops at 500 long, yet gives no error message. Only 500 characters can be extracted even if the <string> is longer.
  • Inexpensive (uses no other templates).

Examples

editar
  • {{str left| lorem ipsum dolor sit amet | 10 }} → lorem ipsu
  • {{str left| lorem ipsum dolor sit amet | 1 }} → l
  • {{str left| lorem ipsum dolor sit amet | 0 }}
  • {{str left| lorem ipsum dolor sit amet | }}
  • {{str left| lorem ipsum dolor sit amet }} → l..

See also

editar
  • {{trunc|<string>|<count>}} - truncate right-side of string
  • {{str right|<string>|<count>}} - extract remainder of string
  • {{str rightc|<string>|<count>}} - extract right-side of string
  • {{str len|<string>}} - get numeric length of string (can be over 300 long)...