Template:Chop head and tail

From Wikispooks
Revision as of 03:11, 5 December 2015 by Robin (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Template documentation[view] [edit] [history] [purge]

Usage

{{Chop head and tail|<string>|<number>}}

This template removes <number> characters from the start and end of <string>.

{{Chop head and tail|12345654321|3}} gives Template:Str left]].


Unlinking

This template can be used to "unlink" a linked parameter.

{{Chop head and tail|[[Einstein]]|2}} results in
Template:Str left]].

Because the default value of <number> is 2, this can be shortened to {{Chop head and tail|[[Einstein]]}}.


Limitations

  • Expensive.
  • When used on strings with characters that carry a meaning in wiki-layout, this template will interpret the character as a layout instruction (bugzilla:12974). For example, {{Chop head and tail|[[123;456]]}} renders as
Template:Str left]]
Template:Str left]]. However, not all characters are in this set.

See also