Difference between revisions of "Template:Str index"

From Ava Zinn Wiki
Jump to: navigation, search
[unchecked revision][unchecked revision]
m (Reverted edits by Happy-melon (talk) to last version by Dragons flight)
(Changing to the much more efficient {{str ≥ len}}. And added "((str index)):" in the beginning of the error message, so we can see what template is error reporting. Tested in /sandbox.)
Line 1: Line 1:
<includeonly>{{#ifexpr:{{str_len|{{{1|}}}}} < {{{2|0}}}|{{FormattingError|String is not long enough}}|<!--
+
<includeonly>{{str ≥ len
-->{{str_index/logic|*{{str_left|{{{1|}}}|{{{2|0}}}}}*|{{str_left|{{{1|}}}|{{#expr:{{{2|0}}}-1}}}}}}<!--
+
| 1 = {{{1|}}}
-->}}</includeonly><noinclude>
+
| 2 = {{{2|0}}}
 +
| 3 = {{str index/logic|*{{str left|{{{1|}}}|{{{2|0}}}}}*|{{str left|{{{1|}}}|{{#expr:{{{2|0}}}-1}}}}}}
 +
| 4 = {{FormattingError|((str index)): String is not long enough.}}
 +
}}</includeonly><noinclude>
  
<nowiki>{{str_index|</nowiki>''text''|''number''<nowiki>}}</nowiki> = Returns the ''number'' character of ''text''.
+
== Template documentation ==
 +
 
 +
<nowiki>{{str index|</nowiki>''text''|''number''<nowiki>}}</nowiki> = Returns the ''number'' character of ''text''.
  
 
Only supports a limited character set.  Returns an error on unknown characters.
 
Only supports a limited character set.  Returns an error on unknown characters.

Revision as of 01:50, 29 March 2009


Template documentation

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

Only supports a limited character set. Returns an error on unknown characters.