Difference between revisions of "Template:Chop head and tail"

From blackwiki
Jump to navigation Jump to search
imported>Guarapiranga
(+asymmetric head + tail chops)
imported>Guarapiranga
m (reverse order)
 
Line 1: Line 1:
<includeonly>{{Str right|nocategory={{{nocategory|}}}|{{Str left|nocategory={{{nocategory|}}}|{{{1|}}}|{{#expr:{{Str len|nocategory={{{nocategory|}}}|{{{1|}}}}}-{{{2|2}}}}}}}|{{{3|{{{2|2}}}}}}}}</includeonly><noinclude>
+
<includeonly>{{Str right|nocategory={{{nocategory|}}}|{{Str left|nocategory={{{nocategory|}}}|{{{1|}}}|{{#expr:{{Str len|nocategory={{{nocategory|}}}|{{{1|}}}}}-{{{3|{{{2|2}}}}}}}}}}|{{{2|2}}}}}</includeonly><noinclude>
 
{{Documentation}}
 
{{Documentation}}
  
 
</noinclude>
 
</noinclude>

Latest revision as of 20:54, 7 December 2019

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

Usage

{{Chop head and tail|<string>|<number-L>|<number-R>}}

This template removes <number-L> characters from the start and <number-R> from the end of <string>:

Template:Xpsoc

A single parameter may be specified if <number-L> = <number-R>:

Template:Xpsoc

Unlinking

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

{{Chop head and tail|[[Einstein]]|2}} results in .

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
  • Supports the character set as defined by {{Str index/getchar}}, so that e.g. {{Chop head and tail|[[Nürnberg]]}} renders correctly as . However, not all characters are in this set.

See also