Skip to content

ContainsText ​

ContainsText performs a case insensitive search for the specified substring ASubText, in the specified string AText.

The function returns a boolean True if one or more instances of ASubText exist in AText.

For a case sensitive search, please review the ContainsStr routine.

Declaration: Function ContainsText(const AText, ASubText : string) : Boolean;

Examples as below.

pascal
procedure ScriptEvent (var Value : variant);
var
  TheText, FullText : string;
  BoYN : boolean;
begin
  TheText := 'two';
  FullText := 'The theories behind why we evolved three-colour vision is wide and varied.';

  BoYN := ContainsText(FullText, TheText);     //Will not find it
 If BoYN = True then
    LogInfo('The subtext is contained withn.')
 else
    LogInfo('The subtext was not found contained within.   Try agin.');

  TheText := 'THREE';

  BoYN := ContainsText(FullText, TheText);    //Will find it
 If BoYN = True then
    LogInfo('The subtext is contained withn.')
 else
    LogInfo('The subtext was not found contained within.   Try agin.');

end;