Contains
- Last UpdatedJan 11, 2023
- 1 minute read
- PI System
- PI Server 2018
- PI Server
Determine if first string contains second string and return True or False.
Syntax
Contains(s1, s2 [,caseSensitive])
Arguments
-
s1
Primary string
-
s2
Substring searched for in primary string
-
caseSensitive
Optional: Boolean that indicates whether the search is case sensitive. If False (or omitted), the search is not case sensitive. If True, the search is case sensitive
Returns
True if the primary string (s1) contains the substring (s2) and False otherwise
Exceptions
If either of the first two arguments (s1 or s2) is not a string, the function returns an error value
If the optional third argument (caseSensitive) is not a Boolean, the function returns an error value
Example
-
Contains("What","Hat",True)
[Returns False]
-
Contains("What","Hat")
[Returns True]
-
Contains("What","at")
[Returns True]
-
Contains("hat","what")
[Returns False]