Module:String2/doc: Difference between revisions

Content deleted Content added
m lower: fixed typo
tidy doc for sentence function
Line 1:
{{module rating|release}}
The module '''String2''' contains five general purposecase-related calls that convert strings to upper, lower, sentence or title case. There are also two utility calls that strip leading zeros from padded numbers and transform text so that it is not interpreted as wikitext.
 
== Functions ==
Line 13:
 
=== sentence ===
The sentence function finds the first letter and capitalises it, then renders the rest of the text in lower case. It works properly with text containing wiki-markup. Compare <code><nowiki>{{#invoke:String2|sentence|[[action game]]}}</nowiki></code> -> {{#invoke:String2|sentence|[[action game]]}} with <code><nowiki>{{ucfirst:{{lc:[[action game]]}}}}</nowiki></code> -> {{ucfirst:{{lc:[[action game]]}}}}. Piped wiki-links are handled as well:
* <code><nowiki>{{#invoke:String2|sentence|[[trimix (breathing gas)|trimix]]}}</nowiki></code> -> {{#invoke:String2|sentence|[[trimix (breathing gas)|trimix]]}}.
So are lists:
* <code><nowiki>{{#invoke:String2 |sentence |{{hlist ||[[apples]] |[[pears]] |[[oranges]]}}}}</nowiki></code> → {{#invoke:String2 |sentence |{{hlist |[[apples]] |[[pears]] |[[oranges]]}}}}
 
=== ucfirst ===