Jump to content

සැකිල්ල:Str right/උපදෙස්

Wikibooks වෙතින්

භාවිතය

[සංස්කරණය]
{{Str right|<string>|<offset>}}

Gives the characters from <offset> to the end of the string.

If <count> is invalid, empty or undefined, this template goes berserk, so don't do that.

  • Up to 100 characters in the input string. If possible, first check length of input string using {{Str len}}. Using strings longer than 100 characters may result in the error "max index is 100 for str sub long".
  • Limited set of characters.
  • Expensive.
  • {{Str right| lorem ipsum dolor sit amet | 10 }} → m dolor sit amet
  • {{Str right| lorem ipsum dolor sit amet | 1 }} → orem ipsum dolor sit amet
  • {{Str right| lorem ipsum dolor sit amet | 0 }} → lorem ipsum dolor sit amet
  • {{Str right| 123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.123456789.1 | 99}} → .max index is 100 for str sub long

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.


"https://si.wikibooks.org/w/index.php?title=සැකිල්ල:Str_right/උපදෙස්&oldid=27856" වෙතින් සම්ප්‍රවේශනය කෙරිණි