Content deleted Content added
fix link |
Remove documentation mentioning upper and lower. |
||
Line 4:
The module '''String2''' contains a number of string manipulation functions that are much less commonly used than those in [[Module:String]]. Because Module:String is cascade-protected (some of its functions are used on the Main Page), it cannot be edited or maintained by template editors, only by admins. While it is true that string-handling functions rarely need maintenance, it is useful to allow that by template editors where possible, so this module may be used by template editors to develop novel functionality.
The module contains
The functions are designed with the possibility of working with text returned from Wikidata in mind. However, a call to Wikidata may return empty, so the functions should generally fail gracefully if supplied with a missing or blank input parameter, rather than throwing an error.
Line 13:
=== upper ===
=== lower ===
=== title ===
Line 28:
=== ucfirst ===
The ucfirst function is similar to sentence; it renders the first alphabetical character in upper case, but leaves the capitalisation of the rest of the text unaltered. This is useful if the text contains proper nouns, but it will not regularise sentences that are ALLCAPS, for example. It also works with text containing piped wiki-links and with html lists. <s><code>label</code> is an alias to this function for backward compatibility.</s>(now
=== findlast ===
Line 134:
== Usage ==
* <code><nowiki>{{#invoke:String2 | sentence |…}}</nowiki></code> - Capitalizes the first character and shifts the rest to lowercase
** Although similar to [[Help:Magic_words#Formatting|magic words]]' <code><nowiki>{{ucfirst:}}</nowiki></code> function, this call works even with piped wiki-links because it searches beyond leading brackets and other non-alphanumeric characters.
Line 147 ⟶ 145:
=== Parameters ===
These functions take one unnamed parameter comprising (or invoking as a string) the text to be manipulated:
* title
* sentence
Line 158 ⟶ 154:
! scope="col" | Input
! scope="col" | Output
|-
| <nowiki>{{#invoke:String2| ucfirst | abcd }}</nowiki>
|