Template:Str number/trim/doc

From 'City of Adelaide' History and Genealogy Site
Jump to navigation Jump to search

{{#invoke:Message box|mbox}} {{#invoke:Lua banner|main}}

The Template:Str_number/trim extracts a number at the start of parameter 1.

It takes a string as parameter, and returns the string trimmed to the beginning number if non-numeric text does not appear before the first number.

Examples

  • {{Str number/trim}} → {{#invoke:String|match|s={{{1}}}|^%d*|ignore_errors=true}}
  • {{Str number/trim|abcde}} → {{#invoke:String|match|s=abcde|^%d*|ignore_errors=true}}
  • {{Str number/trim|abcde123}} → {{#invoke:String|match|s=abcde123|^%d*|ignore_errors=true}}
  • {{Str number/trim|123456}} → {{#invoke:String|match|s=123456|^%d*|ignore_errors=true}}
  • {{Str number/trim|123 456}} → {{#invoke:String|match|s=123 456|^%d*|ignore_errors=true}}
  • {{Str number/trim|1976–2006}} → {{#invoke:String|match|s=1976–2006|^%d*|ignore_errors=true}}
  • {{Str number/trim|19/76+2006}} → {{#invoke:String|match|s=19/76+2006|^%d*|ignore_errors=true}}
  • {{Str number/trim|1234abc}} → {{#invoke:String|match|s=1234abc|^%d*|ignore_errors=true}}
  • {{Str number/trim|1234abc56}} → {{#invoke:String|match|s=1234abc56|^%d*|ignore_errors=true}}
  • {{Str number/trim|12345678901234567890}} → {{#invoke:String|match|s=12345678901234567890|^%d*|ignore_errors=true}}
  • {{Str number/trim|1234567890123456789012345}} → {{#invoke:String|match|s=1234567890123456789012345|^%d*|ignore_errors=true}}
  • {{Str number/trim| 1234567890123456789012345}} → {{#invoke:String|match|s= 1234567890123456789012345|^%d*|ignore_errors=true}}
  • {{Str number/trim|13<ref>a reference</ref>}} → {{#invoke:String|match|s=13[1]|^%d*|ignore_errors=true}}

See also

{{#invoke:Navbox|navbox}}

References

  1. a reference