Jump to content

ထႅမ်းပလဵတ်ႉ:Str left/doc

လုၵ်ႉတီႈ ဝီႇၶီႇပပ်ႉ မႃး

လွင်ႈၸႂ်ႉတိုဝ်း

[မႄးထတ်း]
{{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 or empty, an empty string is returned. If undefined, it defaults to 1.

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

တူဝ်ယၢင်ႇ

[မႄးထတ်း]
  • {{Str left| Lorem ipsum dolor sit amet | 10 }} → Lorem ipsu
  • {{Str left|   Lorem ipsum dolor sit amet | 4 }} → Lore, (note leading spaces trimmed!)
  • {{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

တူၺ်းပႃး

[မႄးထတ်း]

Trimming templates:

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

Analyzing templates:

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

String length comparison templates:

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