Points to raise.
1) Since two $null strings are the same as each other i felt this missed a potential matching.
2) Any string with asc216 "Ø" would have been corrupting the test, you could fix that with var %ts = 255 | while ((%ts) && ($pos($1-,$chr(%ts),1))) { dec %ts } | var %delim = %ts
3) %tok1 would hold an invalid token number if a $null parameter had preceeded it
4) I also didnt like how it returned textual results but thats personal valour,
I wrote this check4match alias
alias c4m {
var %i = 1
while (%i < $0) {
var %j = %i
while (%j < $0) {
inc %j
if ( $ [ $+ [ %i ] ] == $ [ $+ [ %j ] ] ) {
$iif($isid,.) echo -sq * c4m $true %i %j $ [ $+ [ %i ] ]
return $true %i %j $ [ $+ [ %i ] ]
}
}
inc %i
}
$iif($isid,.) echo -sq * c4m $false
return $false
}
* a case-sensitive version could exist using c4mcs and the IF having ===
//c4m a b c d | c4m a b c b | .c4m a b c d | echo $c4m(a,,b,c,b) | echo $c4m(a,,b,,c,d) | echo $c4m(1,b,c,d)
* c4m $false
* c4m $true 2 4 b
<no reply for 3rd example>$true 3 5 b
$true 2 4
$false