updated, as new optional parameter sep=/ can set the word separator to slash (or any other character); put section "Performance considerations" for expansion depth, etc.
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
{{high-use|180612}}
{{lua|Module:String}}
<!----PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE---->
__NOTOC__
__NOTOC__
=== Usage ===
This template returns the first word of the first parameter. Use {{para|1}} for the first parameter if the string may contain an [[equals sign]] (=). By default, words are delimited by spaces, but the optional parameter {{para|sep}} can set the separator to any character.
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.
The template has been optimized to run very quickly, with template expansion depth of 11 levels. The search for the word separator is run only once, with [[Template:Strfind_short]] used to scan the first 25 characters. Performance has been optimized by using [[Template:Strloc_prefix]] to find then extract the first word, else return the whole when not found.
This template is used on approximately 248,000 pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them.
This template returns the first word of the first parameter. Use |1= for the first parameter if the string may contain an equals sign (=). By default, words are delimited by spaces, but the optional parameter |sep= can set the separator to any character.
Usage
One parameter (space as separator):
{{First word|string}}
{{First word|1=string}}
Two parameters (user-defined character as separator):