Difference between revisions of "Template:Str len/core"

From Studio Grow Wiki
Jump to: navigation, search
(Created page with "{{{{{|safesubst:}}}#switch: {{{3|}}} | hundreds = <noinclude><!-- 0xx-4xx, using linear search since most strings will probably be less than 100 bytes. --></noinclude> {{{{{|s...")
m (1 revision)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
{{{{{|safesubst:}}}#switch: {{{3|}}}  | hundreds =  <noinclude><!-- 0xx-4xx, using linear search since most strings will probably be less than 100 bytes. --></noinclude> {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| 100 }}  <noinclude><!--str >= x--></noinclude> | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| 200 }}  | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| 300 }}    | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| 400 }}      | 4      | 3      }}    | 2    }}  | 1  }} |  <noinclude><!-- Don't return 0, since tens and ones don't want a leading 0 in parameter 2. --></noinclude> }}  | tens =  <noinclude><!-- x0x-x9x, using linear search for 0x-3x, binary search for 4x-9x, since most strings will probably be 0-39 bytes. --></noinclude> {{{2|}}}{{ {{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}10 }}  <noinclude><!--str >= x--></noinclude> | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}20 }}  | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}30 }}    | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}40 }}      | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}60 }}        | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}80 }}          | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}90 }}            | 9            | 8            }}          | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}70 }}            | 7            | 6            }}          }}        | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}50 }}          | 5          | 4          }}        }}      | 3      }}    | 2    }}  | 1  }} | {{{{{|safesubst:}}}#if:{{{2|}}}|0}}  <noinclude><!-- Only return 0 if >=100, since ones don't want a leading 0 in parameter 2. --></noinclude> }}  | ones =  <noinclude><!-- xx0-xx9, using binary search. --></noinclude> {{{2|}}}{{ {{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}4 }}  <noinclude><!--str >= x--></noinclude> | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}6 }}  | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}8 }}    | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}9 }}      | 9      | 8      }}    | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}7 }}      | 7      | 6      }}    }}  | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}5 }}    | 5    | 4    }}  }} | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}2 }}  | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}3 }}    | 3    | 2    }}  | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}1 }}    | 1    | 0    }}  }} }}  }}<noinclude>  {{documentation}} <!-- Add categories and interwikis to the /doc subpage, not here! --> </noinclude>
+
{{{{{|safesubst:}}}#switch: {{{3|}}}  | hundreds =  <noinclude><!-- 0xx-4xx, using linear search since most strings will probably be less than 100 bytes. --></noinclude> {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| 100 }}  <noinclude><!--str >= x--></noinclude> | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| 200 }}  | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| 300 }}    | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| 400 }}      | 4      | 3      }}    | 2    }}  | 1  }} |  <noinclude><!-- Don't return 0, since tens and ones don't want a leading 0 in parameter 2. --></noinclude> }}  | tens =  <noinclude><!-- x0x-x9x, using linear search for 0x-3x, binary search for 4x-9x, since most strings will probably be 0-39 bytes. --></noinclude> {{{2|}}}{{ {{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}10 }}  <noinclude><!--str >= x--></noinclude> | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}20 }}  | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}30 }}    | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}40 }}      | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}60 }}        | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}80 }}          | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}90 }}            | 9            | 8            }}          | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}70 }}            | 7            | 6            }}          }}        | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}50 }}          | 5          | 4          }}        }}      | 3      }}    | 2    }}  | 1  }} | {{{{{|safesubst:}}}#if:{{{2|}}}|0}}  <noinclude><!-- Only return 0 if >=100, since ones don't want a leading 0 in parameter 2. --></noinclude> }}  | ones =  <noinclude><!-- xx0-xx9, using binary search. --></noinclude> {{{2|}}}{{ {{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}4 }}  <noinclude><!--str >= x--></noinclude> | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}6 }}  | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}8 }}    | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}9 }}      | 9      | 8      }}    | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}7 }}      | 7      | 6      }}    }}  | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}5 }}    | 5    | 4    }}  }} | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}2 }}  | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}3 }}    | 3    | 2    }}  | {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}1 }}    | 1    | 0    }}  }} }}  }}

Latest revision as of 04:40, 4 April 2011