Template:Choptext

From Holocron - Star Wars Combine
Revision as of 17:41, 22 July 2013 by Rupert Havok (talk | contribs) (Created page with "{{#ifeq: {{#invoke:String|str_find|{{{1|xxz[bad]}}}|{{{2|[}}}|}}|-1 |{{{1}}} |{{padleft:|{{#expr:{{#invoke:String|str_find|{{{1|xxz[bad]}}}|{{{2|[}}}|}}-1}}|{{{1|xxz[bad]}}} ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The Template:Choptext chops, or truncates, a text string in parameter 1 at a specified character, such as "[" or at substring in parameter 2. If the specified substring is not found, then the whole string is returned, unchopped.

Usage:   {{choptext|abcdef|d}} → abc
{{choptext|aabbccddee|cd}} →
{{choptext|My Film (film)| (}} →
{{choptext|No Parentheses| (}} → No Parentheses

If no match is found, then the entire string is returned unchopped. The chop character defaults to a left square bracket "[" as in a hidden category link.