Zelda Wiki

Want to contribute to this wiki?
Sign up for an account, and get started!

Come join the Zelda Wiki community Discord server!

READ MORE

Zelda Wiki
(Expanded instructions and added examples.)
m (Improved code readability + examples)
 
Line 1: Line 1:
  +
<includeonly><!--
<includeonly>{{#vardefine:pick|{{#sub:{{{1|}}}|{{#ifeq:{{{2|}}}|0|0|{{#expr:{{{2|}}}-1}}}}|1}}}}{{#switch:{{lc:{{{3|}}}}}
 
  +
-->{{#vardefine:onepos | {{#ifeq:{{{2|}}}|0|1|{{{2|}}}}} }}<!-- The position - If position is 0, use 1 instead
|uppercase={{uc:{{#var:pick}}}}
 
  +
-->{{#vardefine:zeropos| {{#expr:{{#var:onepos}}-1}} }}<!-- The position, starting from 0 instead of 1 - subtract 1
|upper={{uc:{{#var:pick}}}}
 
  +
-->{{#vardefine:char | {{#sub:{{{1|}}}|{{#var:zeropos}}|1}} }}<!-- The character at the desired position
|u={{uc:{{#var:pick}}}}
 
  +
-->{{#switch:{{lc:{{{3|}}}}}<!-- Convert the character to upper- or lower-case if desired
|lowercase={{lc:{{#var:pick}}}}
 
|lower={{lc:{{#var:pick}}}}
+
-->|uppercase|upper|u = {{uc:{{#var:char}}}}<!--
|l={{lc:{{#var:pick}}}}
+
-->|lowercase|lower|l = {{lc:{{#var:char}}}}<!--
|#default={{#var:pick}}
+
-->|#default = {{#var:char}} <!--
}}</includeonly><noinclude>
+
-->}}</includeonly><noinclude>
 
==Purpose==
 
==Purpose==
 
This template takes a text string and finds the character that is at the desired position.
 
This template takes a text string and finds the character that is at the desired position.
Line 31: Line 31:
   
 
'''Case changing:'''
 
'''Case changing:'''
*'''<nowiki>{{Pick|Link|1|Uppercase}}</nowiki>'''
+
*'''<nowiki>{{Pick|LiNk|1|Uppercase}}</nowiki>'''
**{{Pick|Link|1|Uppercase}}
+
**{{Pick|LiNk|1|u}}
*'''<nowiki>{{Pick|Link|2|Uppercase}}</nowiki>'''
+
*'''<nowiki>{{Pick|LiNk|2|Uppercase}}</nowiki>'''
**{{Pick|Link|2|Uppercase}}
+
**{{Pick|LiNk|2|u}}
*'''<nowiki>{{Pick|Link|3|Uppercase}}</nowiki>'''
+
*'''<nowiki>{{Pick|LiNk|3|Lowercase}}</nowiki>'''
**{{Pick|Link|3|Uppercase}}
+
**{{Pick|LiNk|3|l}}
*'''<nowiki>{{Pick|Link|4|Uppercase}}</nowiki>'''
+
*'''<nowiki>{{Pick|LiNk|4|Lowercase}}</nowiki>'''
**{{Pick|Link|4|Uppercase}}
+
**{{Pick|LiNk|4|l}}
 
[[Category:Formatting Templates|{{PAGENAME}}]]
 
[[Category:Formatting Templates|{{PAGENAME}}]]
 
</noinclude>
 
</noinclude>

Latest revision as of 11:57, 5 August 2017

Purpose

This template takes a text string and finds the character that is at the desired position.

Usage

To use this template, type:     {{Pick|Text String |Target Position |Case (Optional) }}

  • Text String — The string of text to be searched
  • Target Position — Choose the position to be searched. Enter this as numbers starting at 1. Numbers greater than the length of the string should return a blank result.
  • Case — Optionally change the case of the output to uppercase or lowercase. If left blank the result will be returned in the original case.
    • uppercase, upper, or u — Converts to uppercase, parameter is NOT case sensitive.
    • lowercase, lower, or l — Converts to lowercase, parameter is NOT case sensitive.

Examples

Normal use:

  • {{Pick|Link|1}}
    • L
  • {{Pick|Link|2}}
    • i
  • {{Pick|Link|3}}
    • n
  • {{Pick|Link|4}}
    • k

Case changing:

  • {{Pick|LiNk|1|Uppercase}}
    • L
  • {{Pick|LiNk|2|Uppercase}}
    • I
  • {{Pick|LiNk|3|Lowercase}}
    • n
  • {{Pick|LiNk|4|Lowercase}}
    • k