It finds the index of the lowest, then sets %result to the value of it. It could easily do it the other way as well.
Anyway, I barely understood the example.
It could be done like
If you were comparing numbers, and just wanted the lowest number it would be something like
%best="none"
while((%check=%list[%i])!$="")
{
if(%check<%best||%best$="none")%check=%best;
}
If you wanted to compare strings, well I just don't understand exactly what you are looking for, but...
Oh, and I missed that strstr returns -1 on failure, and that would beat the lowest.
%best=1000;
%bestfound=-1;
%i=0;
while(%list[%i]!$="")
{
if((%found=strstr(%string,%list[%i]))<%best)
{
if(%found>-1)
{
%best=%found;
%bestfound=%i;
}
}
}
%result=%list[%bestfound]