Function

SearchMatch

Module

uTemplates

Last Modified

7/15/2014 3:26:44 PM

Scope

Interfaced

Declaration

function SearchMatch(const SubStr, Str: string; const WholeWordsOnly: boolean): boolean;

Called-By Hierarchy


                          SearchMatch
          TfrmFindingTemplates.Find┘ 
                     FindTemplate┘   
       TfrmDrawers.btnFindClick┤     
TfrmTemplateEditor.btnFindClick┘     

Called-By

Name Declaration Comments
TfrmFindingTemplates.Find procedure Find; -


Source

428   function SearchMatch(const SubStr, Str: string; const WholeWordsOnly: boolean): boolean;
429   const
430     AlphaNumeric = ['A'..'Z','a'..'z','0'..'9'];
431   
432   var
433     i, j: integer;
434   
435   begin
436     i := pos(SubStr,Str);
437     if(i > 0) then
438     begin
439       Result := TRUE;
440       if(WholeWordsOnly) then
441       begin
442         if((i > 1) and (Str[i-1] in AlphaNumeric)) then
443           Result := FALSE
444         else
445         begin
446           j := length(SubStr);
447           if((i+j) <= length(Str)) then
448             Result := (not (Str[i+j] in AlphaNumeric));
449         end;
450       end;
451     end
452     else
453       Result := FALSE;
454   end;