has_substring/2—verify the occurrence of a substring within a string or list of strings
The has_substring/2 function verifies the occurrence of a substring within a string or list of strings. The syntax for has_substring/2 function is as follows:
has_substring($LIST,$SUBSTRING)
has_substring/2 syntax argument
Argument | Mode | Type | Description |
---|---|---|---|
$STRING | Input | STRING | String that you want to test for a specified substring |
$LIST | Input | LIST_OF STRING | List of strings that you want to test for a specified substring |
$SUBSTRING | Input | STRING | Substring that you want to search for |
Use the has_substring/2 to determine whether the string specified by $STRING has the value of $SUBSTRING as a substring or to determine whether at least one of the strings of the list specified by $LIST has the value of $SUBSTRING as a substring.
The has_substring/2 primitive succeeds or fails depending on whether or not the substring occurs.
has_substring/2 example
This example searches the msg slot of the event being processed to determine if the slot has NGP as a substring, in upper case.