행위

Strfind short: 두 판 사이의 차이

조무위키

imported>노구리
(새 문서: <noinclude><!-- -============================================================= - Strfind_short - Find a string within another string fast -============================================...)
 
imported>노구리
(틀:Strfind short 문서로 넘겨주기)
 
1번째 줄: 1번째 줄:
<noinclude><!--
#redirect [[틀:Strfind short]]
-=============================================================
- Strfind_short - Find a string within another string fast
-=============================================================
-                                  (see NOTES at bottom)
--></noinclude>{{#expr: 0{{
  #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+0}}|{{{1}}} }}^|`{{{2}}}^|1+0*}}{{
  #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+1}}|{{{1}}} }}^|`{{padleft:|1|{{{1}}} }}{{{2}}}^|2+0*}}{{
  #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+2}}|{{{1}}} }}^|`{{padleft:|2|{{{1}}} }}{{{2}}}^|3+0*}}{{
  #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+3}}|{{{1}}} }}^|`{{padleft:|3|{{{1}}} }}{{{2}}}^|4+0*}}{{
  #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+4}}|{{{1}}} }}^|`{{padleft:|4|{{{1}}} }}{{{2}}}^|5+0*}}{{
  #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+5}}|{{{1}}} }}^|`{{padleft:|5|{{{1}}} }}{{{2}}}^|6+0*}}{{
  #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+6}}|{{{1}}} }}^|`{{padleft:|6|{{{1}}} }}{{{2}}}^|7+0*}}{{
  #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+7}}|{{{1}}} }}^|`{{padleft:|7|{{{1}}} }}{{{2}}}^|8+0*}}{{
  #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+8}}|{{{1}}} }}^|`{{padleft:|8|{{{1}}} }}{{{2}}}^|9+0*}}{{
  #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+9}}|{{{1}}} }}^|`{{padleft:|9|{{{1}}} }}{{{2}}}^|10+0*}}{{
  #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+10}}|{{{1}}} }}^|`{{padleft:|10|{{{1}}} }}{{{2}}}^|11+0*}}<!--
----------------------------- Check to skip lengths > 10
-->{{#ifexpr: {{{lenstr|15}}}+{{{3|1}}}-1 > 10 |{{
    #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+11}}|{{{1}}} }}^|`{{padleft:|11|{{{1}}} }}{{{2}}}^|12+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+12}}|{{{1}}} }}^|`{{padleft:|12|{{{1}}} }}{{{2}}}^|13+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+13}}|{{{1}}} }}^|`{{padleft:|13|{{{1}}} }}{{{2}}}^|14+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+14}}|{{{1}}} }}^|`{{padleft:|14|{{{1}}} }}{{{2}}}^|15+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3|7}}}+15}}|{{{1}}} }}^|`{{padleft:|15|{{{1}}} }}{{{2}}}^|16+0*}} }}<!--
----------------------------- Check to skip lengths > 15
-->{{#ifexpr: {{{lenstr|15}}}+{{{3|1}}}-1 > 15 |{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+16}}|{{{1}}} }}^|`{{padleft:|16|{{{1}}} }}{{{2}}}^|17+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+17}}|{{{1}}} }}^|`{{padleft:|17|{{{1}}} }}{{{2}}}^|18+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+18}}|{{{1}}} }}^|`{{padleft:|18|{{{1}}} }}{{{2}}}^|19+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+19}}|{{{1}}} }}^|`{{padleft:|19|{{{1}}} }}{{{2}}}^|20+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+20}}|{{{1}}} }}^|`{{padleft:|20|{{{1}}} }}{{{2}}}^|21+0*}} }}<!--
----------------------------- Check to skip lengths > 20
-->{{#ifexpr: {{{lenstr|15}}}+{{{3|1}}}-1 > 20 |{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+21}}|{{{1}}} }}^|`{{padleft:|21|{{{1}}} }}{{{2}}}^|22+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+22}}|{{{1}}} }}^|`{{padleft:|22|{{{1}}} }}{{{2}}}^|23+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+23}}|{{{1}}} }}^|`{{padleft:|23|{{{1}}} }}{{{2}}}^|24+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+24}}|{{{1}}} }}^|`{{padleft:|24|{{{1}}} }}{{{2}}}^|25+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+25}}|{{{1}}} }}^|`{{padleft:|25|{{{1}}} }}{{{2}}}^|26+0*}} }}<!--
----------------------------- Check to skip lengths > 25
-->{{#ifexpr: {{{lenstr|15}}}+{{{3|1}}}-1 > 25 |{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+26}}|{{{1}}} }}^|`{{padleft:|26|{{{1}}} }}{{{2}}}^|27+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+27}}|{{{1}}} }}^|`{{padleft:|27|{{{1}}} }}{{{2}}}^|28+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+28}}|{{{1}}} }}^|`{{padleft:|28|{{{1}}} }}{{{2}}}^|29+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+29}}|{{{1}}} }}^|`{{padleft:|29|{{{1}}} }}{{{2}}}^|30+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+30}}|{{{1}}} }}^|`{{padleft:|30|{{{1}}} }}{{{2}}}^|31+0*}} }}<!--
----------------------------- Check to skip lengths > 30
-->{{#ifexpr: {{{lenstr|15}}}+{{{3|1}}}-1 > 30 |{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+31}}|{{{1}}} }}^|`{{padleft:|31|{{{1}}} }}{{{2}}}^|32+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+32}}|{{{1}}} }}^|`{{padleft:|32|{{{1}}} }}{{{2}}}^|33+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+33}}|{{{1}}} }}^|`{{padleft:|33|{{{1}}} }}{{{2}}}^|34+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+34}}|{{{1}}} }}^|`{{padleft:|34|{{{1}}} }}{{{2}}}^|35+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+35}}|{{{1}}} }}^|`{{padleft:|35|{{{1}}} }}{{{2}}}^|36+0*}} }}<!--
----------------------------- Check to skip lengths > 35
-->{{#ifexpr: {{{lenstr|15}}}+{{{3|1}}}-1 > 35 |{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+36}}|{{{1}}} }}^|`{{padleft:|36|{{{1}}} }}{{{2}}}^|37+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+37}}|{{{1}}} }}^|`{{padleft:|37|{{{1}}} }}{{{2}}}^|38+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+38}}|{{{1}}} }}^|`{{padleft:|38|{{{1}}} }}{{{2}}}^|39+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+39}}|{{{1}}} }}^|`{{padleft:|39|{{{1}}} }}{{{2}}}^|40+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+40}}|{{{1}}} }}^|`{{padleft:|40|{{{1}}} }}{{{2}}}^|41+0*}} }}<!--
----------------------------- Check to skip lengths > 40
-->{{#ifexpr: {{{lenstr|15}}}+{{{3|1}}}-1 > 40 |{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+41}}|{{{1}}} }}^|`{{padleft:|41|{{{1}}} }}{{{2}}}^|42+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+42}}|{{{1}}} }}^|`{{padleft:|42|{{{1}}} }}{{{2}}}^|43+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+43}}|{{{1}}} }}^|`{{padleft:|43|{{{1}}} }}{{{2}}}^|44+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+44}}|{{{1}}} }}^|`{{padleft:|44|{{{1}}} }}{{{2}}}^|45+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+45}}|{{{1}}} }}^|`{{padleft:|45|{{{1}}} }}{{{2}}}^|46+0*}} }}<!--
---------------------- Check to skip lengths > 45
-->{{#ifexpr: {{{lenstr|15}}}+{{{3|1}}}-1 > 45 |{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+46}}|{{{1}}} }}^|`{{padleft:|46|{{{1}}} }}{{{2}}}^|47+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+47}}|{{{1}}} }}^|`{{padleft:|47|{{{1}}} }}{{{2}}}^|48+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+48}}|{{{1}}} }}^|`{{padleft:|48|{{{1}}} }}{{{2}}}^|49+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+49}}|{{{1}}} }}^|`{{padleft:|49|{{{1}}} }}{{{2}}}^|50+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+50}}|{{{1}}} }}^|`{{padleft:|50|{{{1}}} }}{{{2}}}^|51+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+51}}|{{{1}}} }}^|`{{padleft:|51|{{{1}}} }}{{{2}}}^|52+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+52}}|{{{1}}} }}^|`{{padleft:|52|{{{1}}} }}{{{2}}}^|53+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+53}}|{{{1}}} }}^|`{{padleft:|53|{{{1}}} }}{{{2}}}^|54+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+54}}|{{{1}}} }}^|`{{padleft:|54|{{{1}}} }}{{{2}}}^|55+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+55}}|{{{1}}} }}^|`{{padleft:|55|{{{1}}} }}{{{2}}}^|56+0*}} }}<!--
---------------------- Check to skip lengths > 55
-->{{#ifexpr: {{{lenstr|15}}} > 55 |{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+56}}|{{{1}}} }}^|`{{padleft:|56|{{{1}}} }}{{{2}}}^|57+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+57}}|{{{1}}} }}^|`{{padleft:|57|{{{1}}} }}{{{2}}}^|58+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+58}}|{{{1}}} }}^|`{{padleft:|58|{{{1}}} }}{{{2}}}^|59+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+59}}|{{{1}}} }}^|`{{padleft:|59|{{{1}}} }}{{{2}}}^|60+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+60}}|{{{1}}} }}^|`{{padleft:|60|{{{1}}} }}{{{2}}}^|61+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+61}}|{{{1}}} }}^|`{{padleft:|61|{{{1}}} }}{{{2}}}^|62+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+62}}|{{{1}}} }}^|`{{padleft:|62|{{{1}}} }}{{{2}}}^|63+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+63}}|{{{1}}} }}^|`{{padleft:|63|{{{1}}} }}{{{2}}}^|64+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+64}}|{{{1}}} }}^|`{{padleft:|64|{{{1}}} }}{{{2}}}^|65+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+65}}|{{{1}}} }}^|`{{padleft:|65|{{{1}}} }}{{{2}}}^|66+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+66}}|{{{1}}} }}^|`{{padleft:|66|{{{1}}} }}{{{2}}}^|67+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+67}}|{{{1}}} }}^|`{{padleft:|67|{{{1}}} }}{{{2}}}^|68+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+68}}|{{{1}}} }}^|`{{padleft:|68|{{{1}}} }}{{{2}}}^|69+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+69}}|{{{1}}} }}^|`{{padleft:|69|{{{1}}} }}{{{2}}}^|70+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+70}}|{{{1}}} }}^|`{{padleft:|70|{{{1}}} }}{{{2}}}^|71+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+71}}|{{{1}}} }}^|`{{padleft:|71|{{{1}}} }}{{{2}}}^|72+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+72}}|{{{1}}} }}^|`{{padleft:|72|{{{1}}} }}{{{2}}}^|73+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+73}}|{{{1}}} }}^|`{{padleft:|73|{{{1}}} }}{{{2}}}^|74+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+74}}|{{{1}}} }}^|`{{padleft:|74|{{{1}}} }}{{{2}}}^|75+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+75}}|{{{1}}} }}^|`{{padleft:|75|{{{1}}} }}{{{2}}}^|76+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+76}}|{{{1}}} }}^|`{{padleft:|76|{{{1}}} }}{{{2}}}^|77+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+77}}|{{{1}}} }}^|`{{padleft:|77|{{{1}}} }}{{{2}}}^|78+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+78}}|{{{1}}} }}^|`{{padleft:|78|{{{1}}} }}{{{2}}}^|79+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+79}}|{{{1}}} }}^|`{{padleft:|79|{{{1}}} }}{{{2}}}^|80+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+80}}|{{{1}}} }}^|`{{padleft:|80|{{{1}}} }}{{{2}}}^|81+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+81}}|{{{1}}} }}^|`{{padleft:|81|{{{1}}} }}{{{2}}}^|82+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+82}}|{{{1}}} }}^|`{{padleft:|82|{{{1}}} }}{{{2}}}^|83+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+83}}|{{{1}}} }}^|`{{padleft:|83|{{{1}}} }}{{{2}}}^|84+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+84}}|{{{1}}} }}^|`{{padleft:|84|{{{1}}} }}{{{2}}}^|85+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+85}}|{{{1}}} }}^|`{{padleft:|85|{{{1}}} }}{{{2}}}^|86+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+86}}|{{{1}}} }}^|`{{padleft:|86|{{{1}}} }}{{{2}}}^|87+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+87}}|{{{1}}} }}^|`{{padleft:|87|{{{1}}} }}{{{2}}}^|88+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+88}}|{{{1}}} }}^|`{{padleft:|88|{{{1}}} }}{{{2}}}^|89+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+89}}|{{{1}}} }}^|`{{padleft:|89|{{{1}}} }}{{{2}}}^|90+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+90}}|{{{1}}} }}^|`{{padleft:|90|{{{1}}} }}{{{2}}}^|91+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+91}}|{{{1}}} }}^|`{{padleft:|91|{{{1}}} }}{{{2}}}^|92+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+92}}|{{{1}}} }}^|`{{padleft:|92|{{{1}}} }}{{{2}}}^|93+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+93}}|{{{1}}} }}^|`{{padleft:|93|{{{1}}} }}{{{2}}}^|94+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+94}}|{{{1}}} }}^|`{{padleft:|94|{{{1}}} }}{{{2}}}^|95+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+95}}|{{{1}}} }}^|`{{padleft:|95|{{{1}}} }}{{{2}}}^|96+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+96}}|{{{1}}} }}^|`{{padleft:|96|{{{1}}} }}{{{2}}}^|97+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+97}}|{{{1}}} }}^|`{{padleft:|97|{{{1}}} }}{{{2}}}^|98+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+98}}|{{{1}}} }}^|`{{padleft:|98|{{{1}}} }}{{{2}}}^|99+0*}}{{
    #ifeq:`{{padleft:|{{#expr: {{{3}}}+99}}|{{{1}}} }}^|`{{padleft:|99|{{{1}}} }}{{{2}}}^|100+0*}}
}}0}}<noinclude><!--endif lenstr > 55, with "0" & endexpr
--------------------------------------------------------------
--NOTES
--    [ These comments are skipped by <noinclude> so they will
--      be omitted & not sent in a formatted Internet page. ]
--
-- NOTE A1: This template searches inside base string {1}, up
--      to length {lenstr}, to match string {2} of length {3},
--      as an embedded substring. In various groups, limited by
--      {lenstr}, it compares string {1} truncated '{3}+n' long
--      against both string {1} truncated to n with string {2}
--      appended, in the comparison.
--
-- NOTE N2: This template was designed to use minimal levels
--      as 5, to avoid the "expansion depth limit" when used
--      in very large templates. By comparison, {str_find}
--      was using over 18 levels of 40 total, during 2010.
--
-- NOTE S3: The speed of search depends on the length parameter
--      {lenstr}, where lenstr > 10 will start #2 of 9 phases
--      of comparisons, because 16% of strings are < 11 long:
--      lenstr > 10 will search the 84% of strings over 10 long,
--      lenstr > 15 will search the 58% of strings over 15 long,
--      lenstr > 20 will search the 32% of strings over 20,
--      lenstr > 25 will search the 16% of strings over 25,
--      lenstr > 30 will search the 8% of strings over 30,
--      lenstr > 35 will search the 4% of strings over 35,
--      lenstr > 40 will search the 2% of strings over 40,
--      lenstr > 45 will search 1.1% of strings over 45 long,
--      lenstr > 55 searches rare 0.3% of strings over 55 long.
--      The exact check of length is {{{lenstr}}}+{{{3}}}-1 > n
--      to also stop if the search string is too long to match.
--
--------------------------------------------------------------
--HISTORY:
--28Dec10 Created to find a string in another by unnested logic.
--28Dec10 Put NOTES comments to explain template coding.
--28Dec10 Put HISTORY comments to log major changes (not typos).
--29Jan11 New {lenstr} for search 3x faster, stopping at length.
--29Jan11 Set default search up to 15 long but allow lenstr=99.
--31Jan11 Check lenstr > 55 to skip searching columns 56-99.
--05Feb11 Check lenstr > 10, 15, 20, 25, 30... as faster search.
--24Nov12 Fixed as prefix "`" to not match "-" at end of strings.
--
-->
{{설명문서}}</noinclude>

2020년 8월 2일 (일) 02:01 기준 최신판

넘겨줄 대상: