Template:Trim


Documentation icon Template documentation[view] [edit] [history] [purge]

This template trims whitespace from a string. The string should be passed as the first unnamed parameter. You may substitute this template - that is, if used as {{subst:trim}}, the resulting wikicode is "clean".

Usage

{{trim|text}} = text with any leading or trailing whitespace removed.

Example

  • {{trim| abc}} produces abc.

Related templates

  • {{Str left}} – To trim down to a specified number of characters, or duplicate the string to a specified number.
  • {{Trim}} — To trim any leading or trailing whitespace.
  • {{Str right}} — To trim the first specified number of characters.
  • {{Str rightc}} — To return a number of characters from the end, 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.
  • {{Strip whitespace}} which does nearly the exact same thing, but which should not be substituted.
  • {{trim}} — Removes whitespace ({{Strip whitespace}} does so too, but is less effective)