Lua error in package.lua at line 80: module 'Module:Wb/lad/Arguments' not found.

Usage edit

{{Wb/lad/Str left|<string>|<count>}}

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

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

Limitations edit

  • 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 edit

  • {{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
  • {{Str left| Lorem ipsum dolor sit amet | 40 }} → Lorem ipsum dolor sit ametLorem ipsum do

See also edit

Trimming templates:

  • {{Wb/lad/Str left}} – To trim down to a specified number of characters, or duplicate the string to a specified number.
  • {{Wb/lad/Str trim}} — To trim any leading or trailing whitespace.
  • {{Wb/lad/Str right}} — To trim the first specified number of characters.
  • {{Wb/lad/Str rightc}} — To trim the first specified number of characters, returns a parameter if the string is empty.
  • {{Wb/lad/Str sub}} — To trim down to a specified number, starting at a given number from the left, less than 50.
  • {{Wb/lad/Str sub long}} — To trim down to a specified number, starting at a given number from the left, less than 100.

Analyzing templates:

  • {{Wb/lad/Str find}} – Returns the numerical location of a given string in a string, up to 50 characters.
  • {{Wb/lad/Str index}} – Returns a given character from a string, but not accented letters.
  • {{Wb/lad/Str index any}} – Returns a given character from a string, but not a space.
  • {{Wb/lad/Str len}} – Returns a string's length. Can count up to 500 characters.

String length comparison templates:

  • {{Wb/lad/Str ≥ len}} – To check if a string is "longer or equally long" or "shorter" than a given length.
  • {{Wb/lad/Str ≤ len}} – To check if a string is "shorter or equally long" or "longer" than a given length.
  • {{Wb/lad/Str ≠ len}} – To check if a string is "not equal" or "equal" to a given length.
  • {{Wb/lad/Str ≤ ≥ len}} – To check if a string is "shorter", "equal", or "longer" than a given length.