Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.
Revision as of 13:11, 11 October 2009 by commons>Wikid77 (indented Usage line; noted 999 gets entire string; stops at limit of 500 but no message will be shown; put See-also text describing each link)

Usage

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

Gives the <count> substring of characters from the start of the string (the substring has length <count>). Use 999 (or such) to get entire string.

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

Limitations

  • 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 over 601 characters long.
  • Fast: uses no other templates.

Examples

  • {{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 | foo }}
  • {{Str left| lorem ipsum dolor sit amet | }}
  • {{Str left| lorem ipsum dolor sit amet }} → l

See also

  • {{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)


Cookies help us deliver our services. By using our services, you agree to our use of cookies.