Template:Trim/doc

This template trims leading and trailing (but not interior) whitespace from a string. The string should be passed as the first unnamed parameter. The parameter must be named  if its value contains a   character.

You may substitute this template via  - that is, if used as, the resulting wikicode is "clean" (i.e., it has no leading or trailing whitespace).

Usage
"" produces "text" - all of the leading and trailing whitespaces around the inputted string are removed.

Handling horizontal whitespace (think: space bar)

 * "" produces ""
 * Without trimming, this would've rendered as " abc"
 * "" produces ""
 * Without trimming, this would've rendered as "xyz "
 * "" produces ""
 * Without trimming, this would've rendered as " abc xyz "

Handling vertical whitespace (think: enter key)
The basic mechanics of how it removes vertical whitespace is illustrated below.

Consider the following wikitext markup: e

Now consider the same wikitext markup from the preceding example without the trim template : abc

d

e

How this template is actually useful
This template can be used to remove extraneous horizontal whitespace (e.g., the character produced by a keyboard's space bar) and vertical line breaks (analogous to the character produced by a keyboard's enter key) from the beginning and end of inputs to template parameters. This can be accomplished by nesting the parameter within a trim template.

In other words, you would use  in place of.