Template:First word/doc
Jump to navigation
Jump to search
{{#invoke:Message box|mbox}} {{#invoke:Lua banner|main}}
Usage
Returns the first word of the first parameter. By default, words are delimited by spaces, but optional parameter sep=/ can set the word separator to slash (or any other character). The parameter should not have leading spaces, unless the word separator, sep, is set to another character.
Examples
- {{first word|Foo bar baz}} → {{#invoke:String|match|s=Foo bar baz|^[^%s]*}}
- {{first word|Foo}} → {{#invoke:String|match|s=Foo|^[^%s]*}}
- {{first word|Foo-bar-baz}} → {{#invoke:String|match|s=Foo-bar-baz|^[^%s]*}}
- {{first word|Foo-bar-baz|sep=- }} → {{#invoke:String|match|s=Foo-bar-baz|^[^-]*}}
- {{first word|34,000,500|sep=, }} → {{#invoke:String|match|s=34,000,500|^[^,]*}}
- {{first word|1=len = a+b |sep== }} → {{#invoke:String|match|s=len = a+b|^[^=]*}}
- {{first word|Hear ye, users |sep=, }} → {{#invoke:String|match|s=Hear ye, users |^[^,]*}}
See also
{{#invoke:Navbox|navbox}}