Template:First word/doc: Difference between revisions

From Zoophilia Wiki
Jump to navigationJump to search
meta>Mr. Stradivarius
add {{lua}} template and remove Category:Lua-based templates, as it is added by the template as well - see Wikipedia talk:Lua#Lua talk template
meta>Sardanaphalus
sandbox non-categorization, template update
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
{{lua|Module:String}}
{{lua|Module:String}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
<!----PLEASE ADD CATEGORIES WHERE INDICATED AT THE BOTTOM OF THIS PAGE---->
__NOTOC__
__NOTOC__
=== Usage ===
===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.
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 ===
===Examples===
 
* {&#123;first word|Foo bar baz}} → {{first word|Foo bar baz}}
* {&#123;first word|Foo bar baz}} → {{first word|Foo bar baz}}
* {&#123;first word|Foo}} → {{first word|Foo}}
* {&#123;first word|Foo}} → {{first word|Foo}}
Line 17: Line 15:
* {&#123;first word|Hear ye, users |sep=, }} → {{first word|Hear ye, users |sep=, }}
* {&#123;first word|Hear ye, users |sep=, }} → {{first word|Hear ye, users |sep=, }}


=== See also ===
===See also===
{{navbox string handling templates}}
{{String-handling templates |trim}}


<includeonly>
<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
{{#ifeq:{{SUBPAGENAME}}|sandbox | |
<!----CATEGORIES BELOW THIS LINE, PLEASE:---->
[[Category:String manipulation templates]]
[[Category:String manipulation templates]]
}}
</includeonly>
</includeonly>

Revision as of 12:53, 7 July 2014

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}} → Foo
  • {{first word|Foo}} → Foo
  • {{first word|Foo-bar-baz}} → Foo-bar-baz
  • {{first word|Foo-bar-baz|sep=- }} → Foo
  • {{first word|34,000,500|sep=, }} → 34
  • {{first word|1=len = a+b |sep== }} → len
  • {{first word|Hear ye, users |sep=, }} → Hear ye

See also