Content deleted Content added
m →See also: fix editor syntax highlighting |
add usage and examples |
||
Line 54:
=== split ===
The ''split'' function splits text at boundaries specified by separator and returns the chunk for the index idx (starting at 1). It can use positional parameters or named parameters (but these should not be mixed):
* <code><nowiki>{{#invoke:String2 |split |text |separator |index |true/false}}</nowiki></code>▼
; Usage
* <code><nowiki>{{#invoke:String2 |split |txt=text |sep=separator |idx=index |plain=true/false}}</nowiki></code>▼
▲
Any double quotes (") in the separator parameter are stripped out, which allows spaces and wikitext like <code><nowiki>["[</nowiki></code> to be passed. Use <code>{{tl|!}}</code> for the pipe character <code>|</code>.
Line 100 ⟶ 103:
The strip function strips the first positional parameter of the characters or pattern supplied in the second positional parameter.
; Usage
: <code><nowiki>{{#invoke:String2|strip|source_string|characters_to_strip}}</nowiki></code>
: <code><nowiki>{{#invoke:String2|strip|source_string|characters_to_strip|plain_flag}}</nowiki></code>
; Examples
: <code><nowiki>{{#invoke:String2|strip|abc123def|123}}</nowiki></code> → {{#invoke:String2|strip|abc123def|123}}
: <code><nowiki>{{#invoke:String2|strip|abc123def|123|true}}</nowiki></code> → {{#invoke:String2|strip|abc123def|123|true}}
: <code><nowiki>{{#invoke:String2|strip|abc123def|%d+|false}}</nowiki></code> → {{#invoke:String2|strip|abc123def|%d+|false}}
=== matchAny ===
|