Difference between revisions of "Template:Str index/doc"

From Ava Zinn Wiki
Jump to: navigation, search
[unchecked revision][unchecked revision]
m (Migrating 10 interwiki links, now provided by Wikidata on d:Q6665834)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 +
{{lua|Module:String}}
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
 
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
  
Line 23: Line 24:
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
 
[[Category:String manipulation templates]]
 
[[Category:String manipulation templates]]
[[Category:Lua-based templates]]
 
  
 
</includeonly>
 
</includeonly>

Revision as of 05:41, 21 July 2013

Gnome-utilities-terminal.svg This template uses (or will be using) Lua programming language.

Please see Wikipedia:Lua if you want to learn more about Lua or help convert other templates.

Usage

{{str index|text|number}} = Returns the number-th character of text.

Base 1: the first character is numbered 1, and so on. Any leading or trailing whitespace is removed from the string before searching.

If the requested position is negative, this function will search the string counting from the last character. In other words, number = -1 is the same as asking for the last character of the string.

A requested position equal to zero or with a value longer than the string will generate an error.

This function will properly return a space character (' ') if the selected position contains a space.

Examples

  • {{str index|0123456789ABCDEF|15}}Character not recognized by string_index
  • {{str index|0123456789ABCDEF|18}}((str index)): String is not long enough.

See also

Template:Navbox string handling templates