Site News
Warning: This wiki contains spoilers. Read at your own risk!

Social media: If you would like, please join our Discord server, and/or follow us on Twitter (X) or Tumblr!

Module:String2/doc

From Fire Emblem Wiki, your source on Fire Emblem information. By fans, for fans.

This is the documentation page for Module:String2

The module "String2" contains 4 available calls that convert strings to upper, lower, sentence or title case.

The sentence case function finds the first letter and capitalises that, so it works properly with text containing wiki-markup. Compare {{#invoke:String2|sentence|action game}} → "Action game" with {{ucfirst:{{lc:action game}}}} → "Action game". Piped wiki-links are handled as well: {{#invoke:String2|sentence|trimix}} → "Trimix".

The title case function capitalises the first letter of each word in the text, apart from a number of short words recommended by The U.S. Government Printing Office Style Manual.

Further functions commonly used on strings would be useful additions.

Usage

  • {{#invoke:String2 | upper |…}} - Capitalizing the whole characters
  • {{#invoke:String2 | lower |…}} - Lowering the whole characters
  • {{#invoke:String2 | label |…}} - Capitalizing the first character. Although similar to magic word {{ucfirst:}}, this works even piped wiki-links.
  • {{#invoke:String2 | sentence |…}} - Capitalizing the first character and lowering the rest
  • {{#invoke:String2 | title |…}} - Capitalizing all words, except a, an, the, at, by, for, in, of, on, to, up, and, as, but, or, and nor.

Parameters

Just one unnamed parameter is used, representing the text to be converted to the required case.

Examples

Input Output
{{#invoke:String2| upper | abcd }} ABCD
{{#invoke:String2| upper | abCD }} ABCD
{{#invoke:String2| upper | ABcd }} ABCD
{{#invoke:String2| upper | ABCD }} ABCD
{{#invoke:String2| upper | }}
 
{{#invoke:String2| lower | abcd }} abcd
{{#invoke:String2| lower | abCD }} abcd
{{#invoke:String2| lower | ABcd }} abcd
{{#invoke:String2| lower | ABCD }} abcd
{{#invoke:String2| lower | }}
 
{{#invoke:String2| label | abcd }} Abcd
{{#invoke:String2| label | abCD }} AbCD
{{#invoke:String2| label | ABcd }} ABcd
{{#invoke:String2| label | ABCD }} ABCD
{{#invoke:String2| label | }}
{{#invoke:String2| label | human X chromosome }} Human X chromosome
 
{{#invoke:String2| sentence | abcd }} Abcd
{{#invoke:String2| sentence | abCD }} Abcd
{{#invoke:String2| sentence | ABcd }} Abcd
{{#invoke:String2| sentence | ABCD }} Abcd
 
{{#invoke:String2| title | abcd }} Abcd
{{#invoke:String2| title | abCD }} Abcd
{{#invoke:String2| title | ABcd }} Abcd
{{#invoke:String2| title | ABCD }} Abcd
{{#invoke:String2| title | }}
{{#invoke:String2| title | the vitamins are in my fresh california raisins}} The Vitamins Are in My Fresh California Raisins

See also

Module:String for the following functions:

  • len
  • sub
  • sublength
  • match
  • pos
  • str_find
  • find
  • replace
  • rep