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
Undid revision 671660547 by Cpiral (talk)
Line 1: Line 1:
<includeonly><--
<includeonly>{{#ifeq: <!-- a sequence of three outputs equal to "04"? -->
-->{{#ifeq: <!-- compare "04" to 4, and if so, output 4-digits pure
   {{#invoke:String|find|{{{1}}}|.}}<!-- Output a zero if no dot.
  What might be "04" is composed of three outputs: dot, len, and fmt -->
   -->{{#invoke:String|len <!-- Length of 4 with sign temporarily filtered? -->
   {{#invoke:String|find|{{{1}}}|.}}<!-- Output the zero if no dot.
     |{{#invoke:String|replace|{{{1}}}|[+-]|plain=false}}}}<!-- filter sign -->
   -->{{#invoke:String|len <!-- Length of 4 with sign and spaces filtered? -->
  <!-- Any fmt given?  If so comparison to "4" will fail -->{{{fmt|}}}
     |{{#invoke:String|replace|{{{1}}}|[-+ ]|plain=false}}}}<!--  
    That replace just filtered out any and all spaces, + or - characters.
    But it's gotta have the minus sign first in the [-charclass].
    Any fmt given?  If so comparison to "4" will fail -->{{{fmt|}}}
| 4 |{{#invoke:String|replace|{{{1}}}|-|&minus;}}<!--  
| 4 |{{#invoke:String|replace|{{{1}}}|-|&minus;}}<!--  
If fmt is nil, found . is 0, and filtered len is 4, then 04=4,  
If fmt is nil, found . is 0, and len is 4, then 04=4,  
and we have just output the number, replacing any - with a minus sign
and we just output the number, replacing any - with a minus sign


Else:  
Else:  

Revision as of 04:59, 16 July 2015