https://heald.nga.gov/mediawiki/index.php?title=Template:Str_len/core&feed=atom&action=history
Template:Str len/core - Revision history
2024-03-28T20:09:27Z
Revision history for this page on the wiki
MediaWiki 1.35.2
https://heald.nga.gov/mediawiki/index.php?title=Template:Str_len/core&diff=432&oldid=prev
Emily Pugh: 1 revision
2012-04-18T17:26:22Z
<p>1 revision</p>
<p><b>New page</b></p><div>{{{{{|safesubst:}}}#switch: {{{3|}}}<br />
<br />
| hundreds = <noinclude><!-- 0xx-4xx, using linear search since most strings will probably be less than 100 bytes. --></noinclude><br />
{{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| 100 }} <noinclude><!--str >= x--></noinclude><br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| 200 }}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| 300 }}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| 400 }}<br />
| 4<br />
| 3<br />
}}<br />
| 2<br />
}}<br />
| 1<br />
}}<br />
| <noinclude><!-- Don't return 0, since tens and ones don't want a leading 0 in parameter 2. --></noinclude><br />
}}<br />
<br />
| 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><br />
{{{2|}}}{{<br />
{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}10 }} <noinclude><!--str >= x--></noinclude><br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}20 }}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}30 }}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}40 }}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}60 }}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}80 }}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}90 }}<br />
| 9<br />
| 8<br />
}}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}70 }}<br />
| 7<br />
| 6<br />
}}<br />
}}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}50 }}<br />
| 5<br />
| 4<br />
}}<br />
}}<br />
| 3<br />
}}<br />
| 2<br />
}}<br />
| 1<br />
}}<br />
| {{{{{|safesubst:}}}#if:{{{2|}}}|0}} <noinclude><!-- Only return 0 if >=100, since ones don't want a leading 0 in parameter 2. --></noinclude><br />
}}<br />
<br />
| ones = <noinclude><!-- xx0-xx9, using binary search. --></noinclude><br />
{{{2|}}}{{<br />
{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}4 }} <noinclude><!--str >= x--></noinclude><br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}6 }}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}8 }}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}9 }}<br />
| 9<br />
| 8<br />
}}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}7 }}<br />
| 7<br />
| 6<br />
}}<br />
}}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}5 }}<br />
| 5<br />
| 4<br />
}}<br />
}}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}2 }}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}3 }}<br />
| 3<br />
| 2<br />
}}<br />
| {{{{{|safesubst:}}}#ifeq: x{{{1|}}} | x{{{{{|safesubst:}}}padleft:{{{1|}}}| {{{2|}}}1 }}<br />
| 1<br />
| 0<br />
}}<br />
}}<br />
}}<br />
<br />
}}<noinclude><br />
<br />
{{documentation}}<br />
<!-- Add categories and interwikis to the /doc subpage, not here! --><br />
</noinclude></div>
Emily Pugh