Template:Val/delimitnum: Difference between revisions
From Zoophilia Wiki
Jump to navigationJump to search
meta>Cpiral remove spaces from {{{1}}} before calculating "4-digit-pure", the output fmt w no gaps or commas; improve comments |
meta>Cpiral |
||
Line 1: | Line 1: | ||
<includeonly | <includeonly>{{#ifeq: <!-- a sequence of three outputs equal to "04"? --> | ||
{{#invoke:String|find|{{{1}}}|.}}<!-- Output a zero if no dot. | |||
-->{{#invoke:String|len <!-- Length of 4 with sign temporarily filtered? --> | |||
{{#invoke:String|find|{{{1}}}|.}}<!-- Output | |{{#invoke:String|replace|{{{1}}}|[+-]|plain=false}}}}<!-- filter sign --> | ||
-->{{#invoke:String|len <!-- Length of 4 with sign | <!-- Any fmt given? If so comparison to "4" will fail -->{{{fmt|}}} | ||
|{{#invoke:String|replace|{{{1}}}|[- | |||
| 4 |{{#invoke:String|replace|{{{1}}}|-|−}}<!-- | | 4 |{{#invoke:String|replace|{{{1}}}|-|−}}<!-- | ||
If fmt is nil, found . is 0, and | If fmt is nil, found . is 0, and len is 4, then 04=4, | ||
and we | and we just output the number, replacing any - with a minus sign | ||
Else: | Else: |