ଛାଞ୍ଚ:Infobox person/length/locate
ଦେଖଣା
ଛାଞ୍ଚ:Infobox person/length/switch
ଛାଞ୍ଚ:Infobox person/length is one of three templates used to automatically add conversions of length measurements displayed by infoboxes, such as the |reach= parameter in {{Infobox boxer}}.
- Template:Infobox person/length changes text for units of length to the abbreviations "cm" or "in", then passes the string to:
- Template:Infobox person/length/locate which replaces any instances of
with a space, and determines the positions of "cm" or "in" within that string, all of which is passed to: - Template:Infobox person/length/switch which does the conversion
Usage
[ସମ୍ପାଦନା]{{Template:Infobox person/length/locate|198 cm}}→ ଛାଞ୍ଚ:Infobox person/length/switch{{Template:Infobox person/length/locate|198 cm}}→ ଛାଞ୍ଚ:Infobox person/length/switch{{Template:Infobox person/length/locate|78 in}}→ ଛାଞ୍ଚ:Infobox person/length/switch{{Template:Infobox person/length/locate|78 in}}→ ଛାଞ୍ଚ:Infobox person/length/switch{{Template:Infobox person/length/locate|198 cm (2012)}}→ ଛାଞ୍ଚ:Infobox person/length/switch{{Template:Infobox person/length/locate|78 in (2012)<ref>citation goes here</ref>}}→ ଛାଞ୍ଚ:Infobox person/length/switch
Exceptions
[ସମ୍ପାଦନା]Does not replace numbers in hard-coded conversions (examples intentionally show incorrect conversions):
{{Template:Infobox person/length/locate|198 cm (71 in)}}→ ଛାଞ୍ଚ:Infobox person/length/switch{{Template:Infobox person/length/locate|78 in (191 cm)}}→ ଛାଞ୍ଚ:Infobox person/length/switch
Does not replace numeric output of conversion templates such as {{convert}} (examples have precision different than usual):
{{Template:Infobox person/length/locate|{{convert|198|cm|in|2|abbr=on}}}}→ ଛାଞ୍ଚ:Infobox person/length/switch{{Template:Infobox person/length/locate|{{convert|78|in|cm|1|abbr=on}}}}→ ଛାଞ୍ଚ:Infobox person/length/switch
Technical details
[ସମ୍ପାଦନା]The following example shows how the template works:
{{Infobox person/length/switch
|{{{1|198 cm}}}
|{{#invoke:String|replace|{{{1|198 cm}}}| | }}
|c={{#invoke:String|find|{{#invoke:String|replace|{{{1|198 cm}}}| | }}|cm}}
|i={{#invoke:String|find|{{#invoke:String|replace|{{{1|198 cm}}}| | }}|in}}
}}
Result:
{{Infobox person/length/switch
|198 cm
|198 cm
|c=5
|i=0
}}