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

From Ava Zinn Wiki
Jump to: navigation, search
[unchecked revision][unchecked revision]
(Notes)
Line 3: Line 3:
  
 
=== Usage ===
 
=== Usage ===
<nowiki>{{str index|</nowiki>''text''|''number''<nowiki>}}</nowiki> = Returns the ''number''-th character of ''text''.
+
<nowiki>{{str index|</nowiki>''text''|''number''<nowiki>}}</nowiki> = Returns the ''number''-th character of ''text''. Base 1: the first character is numbered 1, and so on.
  
 
Only supports a limited character set.  Returns an error on unknown characters. Returns &amp;#32; for a blank space.
 
Only supports a limited character set.  Returns an error on unknown characters. Returns &amp;#32; for a blank space.
 +
 +
{{Str character set/doc}}
  
 
=== Examples ===
 
=== Examples ===
* {{tlp|str index|0123456789ABCDEF|15}} → {{str index|0123456789ABCDEF|15}}
+
* <code>{{tlp|str index|0123456789ABCDEF|15}}</code> → {{str index|0123456789ABCDEF|15}}
* {{tlp|str index|0123456789ABCDEF|18}} → {{str index|0123456789ABCDEF|18 |nocategory=true}}
+
* <code>{{tlp|str index|0123456789ABCDEF|18}}</code> → {{str index|0123456789ABCDEF|18 |nocategory=true}}
* <code><nowiki>{{str len|{{str index|a b|2}}}}</nowiki></code> → {{str len|{{str index|a b|2}}}}
+
* <code><nowiki>{{str len|{{str index|a b|2}}}}}}</nowiki></code> → {{str len|{{str index|a b|2}}}} (because the return is <code>&amp;#32;</code> rather than a space character.)
  
 
=== See also ===
 
=== See also ===

Revision as of 08:09, 2 March 2012

Usage

{{str index|text|number}} = Returns the number-th character of text. Base 1: the first character is numbered 1, and so on.

Only supports a limited character set. Returns an error on unknown characters. Returns &#32; for a blank space.

Template:Str character set/doc

Examples

  • {{str index|0123456789ABCDEF|15}}Character not recognized by string_index
  • {{str index|0123456789ABCDEF|18}}((str index)): String is not long enough.
  • {{str len|{{str index|a b|2}}}}}} → 129 (because the return is &#32; rather than a space character.)

See also

Template:String templates see also