Please remember that WiKirby contains spoilers, which you read at your own risk! See our general disclaimer for details.

Module:String2/doc

From WiKirby, your independent source of Kirby knowledge.
Jump to navigationJump to search

This is the documentation page for Module:String2

A module that can be used to modify strings of text, typically invoked via templates like {{lowercase}} and {{Sentence}}. Used by typing {{#invoke:String2|type of modification|String to modify}}, with other parameters that may be used depending on the type of modification.

Types[edit]

  • upper: RETURNS IN ALL UPPERCASE
  • lower: returns in all lowercase
  • sentence: Returns in sentence case. First letter after periods is capitalized, but nothing else.
  • title: Returns All Words With a Capital First Letter Except for Some Minor Words
  • findlast: Finds the last item in a list. 3rd parameter is list separator, defaults to , if left blank
  • stripZeros: Removes leading zeros from numbers
  • nowiki: Functions like <nowiki> tags.
  • posnq: Short for position, no quotes. Returns the position in a block of text that the 3rd parameter first appears in.
  • val2percent: Converts decimal numbers to percentages of 100
  • one2a: Converts all instances of one to a or an based on next letter.
  • findpagetext: Is supposed to search for that string in the page specified in the title= parameter and returns the value in the nomatch= parameter if it is not found.
  • Split (copied from the Lua comments in the module itself):

split splits text at boundaries specified by separator and returns the chunk for the index idx (starting at 1)

#invoke:String2 |split |text |separator |index |true/false
#invoke:String2 |split |txt=text |sep=separator |idx=index |plain=true/false

if plain is false/no/0 then separator is treated as a Lua pattern - defaults to plain=true