36 lines
550 B
Plaintext
36 lines
550 B
Plaintext
function findIn(%haystack,%needles)
|
|
{
|
|
%hc = getWordCount(%haystack);
|
|
%nc = getWordCount(%needles);
|
|
|
|
for(%i=0;%i<%nc;%i++)
|
|
{
|
|
%nword = getWord(%needles,%i);
|
|
%index[%nword] = -1;
|
|
}
|
|
|
|
for(%i=0;%i<%hc;%i++)
|
|
{
|
|
%hword = getWord(%haystack,%i);
|
|
|
|
for(%j=0;%j<%nc;%j++)
|
|
{
|
|
%nword = getWord(%needles,%j);
|
|
|
|
if(%hword $= %nword)
|
|
{
|
|
%index[%nword] = %i;
|
|
}
|
|
}
|
|
}
|
|
|
|
for(%i=0;%i<%nc;%i++)
|
|
{
|
|
%nword = getWord(%needles,%i);
|
|
%string = %string SPC %nword@"_"@%index[%nword];
|
|
%string = trim(%string);
|
|
}
|
|
|
|
return %string;
|
|
}
|