<i>add parameter ?lastIndex? to [string first]</i> status still Open with 4 other changes
by
.
D 2016-03-08T07:47:49.811
J icomment >\sto\scompose\s[string\sfirst]\swith\s[string\srange]\r\n\r\nThis\swas\smy\sfirst\sassumption\swhen\slooking\sat\sthe\simplementation\sof\strimPrefix.\sThen\sI\sthought\sthat\ssomeone\smight\shave\schosen\sto\s_not_\screate\sa\scopy\sof\sthe\sprefix\sof\ssize\sof\sneedle.\sAnd\s[string\sfirst\s$needle\s[string\srange\s$haystack\s0\s[string\slength\s$needle]-1]]\sis\ssomewhat\slengthy.\r\n\r\n%\stime\s{string\sfirst\s$needle\s$haystack}\s1000\r\n13.128\smicroseconds\sper\siteration\r\n%\stime\s{string\sfirst\s$needle\s[string\srange\s$haystack\s0\s[string\slength\s$needle]-1]}\s1000\r\n1.435\smicroseconds\sper\siteration\r\n%\s#\sother\smachine\sthan\sthe\sabove\smeasurement:\sassuming\s+50%\sto\s+100%\sslower\sthan\s[string\sfirst\s$needle\s$haystack\s0\s0];\r\n%\s#\salso\snote\sthat\sa\sstring\scomparison\s(not\sinteger\sas\safter\s[string\sfirst])\sis\sstill\sleft\sto\strimPrefix\s...\r\n\r\nIn\sthe\send,\sI\slooked\sat\sthe\sC\scode\sand\sfound\sthat\sit\swas\san\seasy\stask\sto\sadd\sthis\sfeature.\sIt\sis\san\sextension\sthat\smight\sor\smight\snot\sbe\sinteresting\sfor\sthe\scommunity.\sI\spackage\sour\scustom\sversion\sfrom\spristine\ssources\sand\scan\stherefore\seasily\sprovide\sthe\spatch\sas-is.\sI\sadded\stests,\sbut\sno\sdoc.\r\n\r\nOT:\sI\salso\sconsidered\sanother\spatch\sto\sallow\smultiple\s+\sand\s-\sin\sthe\sindex,\se.g.\sconsider\sthe\spostfix\sscenario\s[string\srange\s$haystack\send-[string\slength\s$needle]+1\send].
J login anonymous
J mimetype text/plain
J username heinrichmartin
K d2323d6c284a5081e818dc02f0bbe695a7aa1c61
U anonymous
Z e77ebd264afbc3e4db880108d33ff572