---
url: >-
  /statelake/scripting-reference/functions-and-procedures/string-functions/containsstr.md
---

# ContainsStr

**ContainsStr** performs a case sensitive 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 search that is not case sensitive, use the  [ContainsText](/statelake/scripting-reference/functions-and-procedures/string-functions/containstext)  routine.

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

Examples as below.

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

  TheText := 'two';
  BoYN := ContainsStr(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 := ContainsStr(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 := ContainsStr(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;
```
