Darwin Help

Back to Index

ApproxSearchString

Function ApproxSearchString


Calling Sequence  ApproxSearchString(pat,txt,tol)
Parameters
NameTypeDescription

pat string 
txt string 
tol {0, posint} 
Return Type  {-1,posint}
Synopsis The tolerance tol specifies how many mismatches are allowed between the pattern pat and the body of text txt. If pat is found in txt (within tol mismatches), the offset in txt is returned. Otherwise, -1 is returned. Note, spaces count as mismatches and case differences do not count as mismatches.
Examples
> txt := 'AAAAAAAAAHeLLoBBBBB';
txt := AAAAAAAAAHeLLoBBBBB
> j := ApproxSearchString('hallo', txt, 1);
j := 9
> j+txt;
HeLLoBBBBB
> ApproxSearchString('nothing', 'N.O.T.H.I.N.G.', 4);
-1




See also BestSearchString,   CaseSearchString,   HammingSearchString,   SearchDelim,   SearchMultipleString,   SearchString