next up previous contents
Next: Best String Match Up: Searching Functions Previous: Searching Functions

Approximate string Search

Calling Sequence:
ApproxSearchString(pat, text, tol)
pat : string
text : string
tol : {0, posint}

Returns: {posint, -1}

Synopsis: The tolerance tol specifies how many mismatches are allowed between the pattern pat and the body of text text. If pat is found in text (within tol mistmatches), the offset of the character before the place where pat was found in text is returned. If it is not, -1 is returned. Note, spaces count as mismatches.


> ApproxSearchString('hallo', 'AAAAAAAAHeLLoBBBBB', 1);   # german to english
> ApproxSearchString('nothing', 'N.O.T.H.I.N.G.', 4);     # nothing found

See also: SearchString, CaseSearchString, SearchString

Gaston Gonnet