Template:Trim

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search
[edit] [purge] Template-info.svg Template documentation

Description

Trims whitespace (regular spaces, tabs, new lines) from the beginning and end of its input. Can be used for text, but is more useful for templates.

Usage

{{Trim|input}}

Examples

Text

"{{Trim| Example text }}"

"Example text"

Images

A new line in an image link will prevent it from being rendered:

[[File:
Example.jpg|100px]]

[[File: Example.jpg|100px]]

But when trimmed:

[[File:{{trim|
Example.jpg}}|100px]]

Example.jpg

Templates

A template wishing to accept block-layout arguments must trim input of any unnamed (numbered) parameters for exactly the same reason:

{{some image handling template|[[File:{{trim|{{{1}}}}}]]}}

Won't break when called as:

{{some image handling template
| Example.jpg
}}

History

Was originally called Template:StripWhitespace here. Subsequently updated to use Wikipedia's template code, and renamed to Template:Trim.

Further reading