Template:Chop head and tail/doc
< Template:Chop head and tail
Revision as of 11:57, 21 March 2013 by Unknown user (talk)
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 ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ len.
Unlinking
This template can be used to "unlink" a linked parameter.
{{Chop head and tail|[[Einstein]]|2}}
results in Template:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ len.
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 ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ len - Supports the character set as defined by {{Str index/getchar}}, so that e.g.
{{Chop head and tail|[[Nürnberg]]}}
renders correctly as Template:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ lenTemplate:Str ≥ len. However, not all characters are in this set.
See also
- {{Unlink}}
Description of all string templates