SublimeText has this amazing navigation tool, part of which is based on a very powerful contains behavior.
It takes each character you’ve typed into your filter, and it looks for those characters in the potential matches by looking for the characters in the same order, but they don’t have to be next to each other (and it’s case insensitive).
So typing: abf.c will match things like ABFile.clw (bold letters show matches).
To use it
BIND('STContains' , STContains)
BIND('mat:Description' , mat:Description) !<-- specific to my example
BIND('lcl:Filter_Actual', lcl:Filter_Actual) !<-- specific to my example
and
BRW1::View:Browse{Prop:Filter} = |
CLIP( BRW1::View:Browse{Prop:Filter} ) & |
'AND STContains( lcl:Filter_Actual, mat:Description )'
! the CLIP might be redundant
and
MAP
STContains(STRING xLookFor, STRING xSearchIn ),LONG
END
and
STContains PROCEDURE(STRING xLookFor, STRING xSearchIn )!,LONG
!Returns 0, if not all chars match (in order)
!Returns index of the last matching character (when all match)
Answer LONG !no ,AUTO
CurrChar LONG,AUTO
CODE
xLookFor = UPPER(xLookFor )
xSearchIn = UPPER(xSearchIn)
LOOP CurrChar = 1 TO LEN(CLIP(xLookFor))
Answer = INSTRING( xLookFor[CurrChar], xSearchIn, 1, Answer + 1)
IF Answer = 0 THEN BREAK END
END
!v--- early version to prove the whole concept worked
!Answer = INSTRING( CLIP(xLookFor), UPPER(xSearchIn), 1, 1)
!Assert(0,eqDBG&'STContains Answer['& Answer &'] = xLookFor['& xLookFor &'] xSearchIn['& xSearchIn &']')
RETURN Answer