வார்ப்புரு:Str len/core
{{{{{|safesubst:}}}#switch: {{{3|}}}
 
 | hundreds =   &lt;noinclude&gt;&lt;!-- 0xx-4xx, using linear search since most strings will probably be less than 100 bytes. --&gt;&lt;/noinclude&gt;
 {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| 100 }}  &lt;noinclude&gt;&lt;!--str &gt;= x--&gt;&lt;/noinclude&gt;
 | {{{{{|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
   }}
 |   &lt;noinclude&gt;&lt;!-- Don't return 0, since tens and ones don't want a leading 0 in parameter 2. --&gt;&lt;/noinclude&gt;
 }}
 
 | tens =   &lt;noinclude&gt;&lt;!-- x0x-x9x, using linear search for 0x-3x, binary search for 4x-9x, since most strings will probably be 0-39 bytes. --&gt;&lt;/noinclude&gt;
 {{{2|}}}{{
 {{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}10 }}  &lt;noinclude&gt;&lt;!--str &gt;= x--&gt;&lt;/noinclude&gt;
 | {{{{{|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}}   &lt;noinclude&gt;&lt;!-- Only return 0 if &gt;=100, since ones don't want a leading 0 in parameter 2. --&gt;&lt;/noinclude&gt;
 }}
 
 | ones =   &lt;noinclude&gt;&lt;!-- xx0-xx9, using binary search. --&gt;&lt;/noinclude&gt;
 {{{2|}}}{{
 {{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}4 }}  &lt;noinclude&gt;&lt;!--str &gt;= x--&gt;&lt;/noinclude&gt;
 | {{{{{|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
     }}
   }}
 }}
 
 }}&lt;noinclude&gt;
 
 {{documentation}}
 &lt;!-- Add categories and interwikis to the /doc subpage, not here! --&gt;