Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Analytics and Notifications for PI System Explorer (PI Server 2024 R2)

InStr

  • Last UpdatedOct 04, 2024
  • 1 minute read

Return the location within a string where a sub-string match is first found.

Syntax

InStr([start,] s1, s2 [,caseSensitive])

Arguments

  • start

    Optional: An integer specifying which character in s1 to start the comparison. Must be larger than or equal to 1.

  • s1, s2

    Two strings to be compared.

  • caseSensitive

    Optional: A flag indicating if the comparison is case-sensitive. If 0 (the default) the comparison is case-insensitive, if 1, the comparison is case-sensitive.

Returns

0 if s2 is not a sub-string of s1 starting from the start position; otherwise, the location of character where s2 first matches the characters in s1 from the start position.

Exceptions

Wildcard characters are not treated as wildcards.

Example

  • InStr("What", "At")

    [Returns 3]

  • InStr("What What What", "What")

    [Returns 1]

  • InStr("what", "At", 1)

    [Returns 0]

  • InStr(4, "what", "At")

    [Returns 0]

  • InStr('att1', "Error")

    [Returns 1 if the value of att1 is "Error"]

In This Topic
TitleResults for “How to create a CRG?”Also Available in