Anonymous
×
Create a new article
Write your page title here:
We currently have 205 articles on Shadowrun Seattle Shutdown. Type your article name above or click on one of the titles below and start writing!



Shadowrun Seattle Shutdown

Template:SplitP: Difference between revisions

(Created page with "{{Documentation}} <includeonly><onlyinclude>{{#switch:{{{2|out}}} | out = {{#explode:{{{1}}}|(|0}} | in = {{#explode:{{{1}}}|(|-1}} | #default = {{Error|{{Code|{{{2}}}}} is not a valid parameter for {{Template|SplitP}}}} }}</onlyinclude></includeonly>")
 
No edit summary
Line 2: Line 2:
<includeonly><onlyinclude>{{#switch:{{{2|out}}}
<includeonly><onlyinclude>{{#switch:{{{2|out}}}
| out = {{#explode:{{{1}}}|(|0}}
| out = {{#explode:{{{1}}}|(|0}}
| in = {{#explode:{{{1}}}|(|-1}}
| in = {{#explode:{{{1}}}{{#explode:{{{1}}}|(|-1}}|)|0}}
| #default = {{Error|{{Code|{{{2}}}}} is not a valid parameter for {{Template|SplitP}}}}
| #default = {{Error|{{Code|{{{2}}}}} is not a valid parameter for {{Template|SplitP}}}}
}}</onlyinclude></includeonly>
}}</onlyinclude></includeonly>

Revision as of 19:06, 24 October 2022

Icon-documentation.svg

Template:SplitP (Split Parenthesis) is a string parsing template. It extracts the text from inside or outside the parenthesis and returns it.

Usage

It accepts one mandatory string parameter and one optional string parameter.

  • 1 is the string to be parsed. There can be only one set of parenthesis, and they must come last in the string.
  • 2 (default: out) controls which portion of the string is returned, either what's outside the parenthesis or inside. Any other input triggers an error.

Return

{{SplitP|Human (Cheerleader)|out}} returns:
Human
{{SplitP|Human (Cheerleader)|in}} returns:
Human (Cheerleader
{{SplitP|Human|out}} returns:
Human
{{SplitP|Human|in}} returns:
HumanHuman
{{SplitP|Human (Cheerleader)|foo}} returns:
Error! foo is not a valid parameter for Template:SplitP!

The documentation above was transcluded from Template:SplitP/Documentation.