(Created page with "{{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 {{Parameter|mandatory|string}} and one {{Parameter|optional|string}}. * {{Code|1}} is the string to be parsed. There can be only one set of parenthesis, and they must come last in the string. * {{Code|2}} (default: {{code|out}}) controls which portion of the string is returned, either what's {{code|out}...") |
No edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<includeonly>[[Category:String Template]]</includeonly> | |||
{{Template|SplitP}} (Split Parenthesis) is a string parsing template. It extracts the text from inside or outside the parenthesis and returns it. | {{Template|SplitP}} (Split Parenthesis) is a string parsing template. It extracts the text from inside or outside the parenthesis and returns it. | ||
==Usage== | ==Usage== | ||
| Line 5: | Line 6: | ||
* {{Code|2}} (default: {{code|out}}) controls which portion of the string is returned, either what's {{code|out}}side the parenthesis or {{code|in}}side. Any other input triggers an error. | * {{Code|2}} (default: {{code|out}}) controls which portion of the string is returned, either what's {{code|out}}side the parenthesis or {{code|in}}side. Any other input triggers an error. | ||
==Return== | ==Return== | ||
{{Code|<nowiki>{{SplitP|Human (Cheerleader | {{Code|<nowiki>{{SplitP|Human (Cheerleader)|out}}</nowiki>}} returns: {{Return|{{SplitP|Human (Cheerleader)|out}}}} | ||
{{Code|<nowiki>{{SplitP|Human (Cheerleader | {{Code|<nowiki>{{SplitP|Human (Cheerleader)|in}}</nowiki>}} returns: {{Return|{{SplitP|Human (Cheerleader)|in}}}} | ||
{{Code|<nowiki>{{SplitP|Human (Cheerleader | {{Code|<nowiki>{{SplitP|Human|out}}</nowiki>}} returns: {{Return|{{SplitP|Human|out}}}} | ||
{{Code|<nowiki>{{SplitP|Human|in}}</nowiki>}} returns: {{Return|{{SplitP|Human|in}}}} | |||
{{Code|<nowiki>{{SplitP|Human (Cheerleader)|foo}}</nowiki>}} returns: {{Return|{{SplitP|Human (Cheerleader)|foo}}}} | |||
Latest revision as of 13:23, 26 April 2023
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.
1is 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'soutside the parenthesis orinside. Any other input triggers an error.
Return
{{SplitP|Human (Cheerleader)|out}} returns:
Human
{{SplitP|Human (Cheerleader)|in}} returns:
Cheerleader
{{SplitP|Human|out}} returns:
Human
{{SplitP|Human|in}} returns:
Human
{{SplitP|Human (Cheerleader)|foo}} returns:
Error!
foo is not a valid parameter for Template:SplitP!