Module:String/doc: Difference between revisions
From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
no edit summary
(removing a protection template from a non-protected page (info)) |
No edit summary |
||
(9 intermediate revisions by 7 users not shown) | |||
Line 1:
{{High-risk|all-pages=yes}}
{{Used in system}}
{{Module rating|protected}}
{{Lmd|String}}
Line 145 ⟶ 143:
* <code><nowiki>{{#invoke:String|match|s= abc123%d+ |pattern= %d+ }}</nowiki></code> → {{#invoke:String|match|s= abc123%d+ |pattern= %d+ }}
* <code><nowiki>{{#invoke:String|match|s= abc123%d+ |pattern= %d+ |plain= true }}</nowiki></code> → {{#invoke:String|match|s= abc123%d+ |pattern= %d+ |plain= true }}
* <code><nowiki>{{#invoke:String|match|s= abc |pattern= %d }}</nowiki></code> → {{#invoke:String|match|s= abc |pattern= %d |no_category=true}}
* <code><nowiki>{{#invoke:String|match|s= abc |pattern= %d |nomatch= No numeric characters in string }}</nowiki></code> → {{#invoke:String|match|s= abc |pattern= %d |nomatch= No numeric characters in string }}
* <code><nowiki>{{#invoke:String|match|s= abc |pattern= %d |ignore_errors= true }}</nowiki></code> → {{#invoke:String|match|s= abc |pattern= %d |ignore_errors= true }}
Line 252 ⟶ 250:
* <code><nowiki>{{#invoke:String|find|source= abc123def |target=c|plain=false}}</nowiki></code> → {{#invoke:String|find|source= abc123def |target=c|plain=false}}
== replace (gsub) ==
This function allows one to replace a target string or pattern within another string. To Lua programmers: this function works internally by calling {{code|string.gsub}}.
Usage:
Line 367 ⟶ 365:
== endswith ==
Usage:
: <code><nowiki>{{#invoke:</nowiki>String|
OR
: <code><nowiki>{{#invoke:</nowiki>String|
Returns "yes" if the source string ends with the pattern string. Both strings are trimmed before use.
|