check+.muf
check+.muf · 1.1 KB
From the archive IrvPage250.tar.gz
Download the archive « Back to the archive contents
( CheckPlus ) ( By Irvin' ) ( NewPegasus ) ( 6 Sep 92 )
( )
( {s: <string_to_match>} {s: <from_strings>} {i: <number_of_from_strings>} )
( -- {S: <matched_string>} )
( )
( Adapted from .PMatchPlus by Parade )
( )
: PopN dup 0 = if pop exit then swap pop 1 - PopN ;
: PartialMatch ( {s: <string_to_match>} {s: <from_strings>} {i: <counter>}
-- {S: <matched_string>} )
dup 3 pick > if
pop dup 2 + rotate pop
exit
then
dup 2 + pick
3 pick 4 + pick
swap over strlen strcut pop swap
stringcmp if
dup 2 + rotate pop
swap 1 - swap
else
1 +
then
PartialMatch
;
: CheckPlus
1 PartialMatch
dup 1 < if pop
""
else
dup 1 > if
PopN
""
else pop
then
then
;