|Function||avi.stringgroup.contains ( stringgroup, string )|
|Description||String groups are simple lists of string data. This functions evaluates a custom string to see if it exists within an entry of a string group. If the string group has been configured as a key/value pair mapping, the string is compared to see if it matches a key, and will return the string from the key's value field.
The string comparison returns true upon the shortest match. If the string group has entries for a, ab, abc, and the evaluated string is 'abcdef', the function will match the 'a' since it is the shortest valid match.
|Parameter||stringgroup is the name of the String Group to make the comparison against. The string group must be mapped to the DataScript in the DataScript creation of the GUI or API.
string is the custom data to search for within the string group
CASE - By default, the comparison is performed as case insensitive. In order to perform the case as sensitive, use the following syntax: avi.stringgroup.contains_CASE( "stringgroup", "string")
Strarting with Avi Vantage 20.1.1, the String group Datascript accepts String Group names as variables too.
|Returns||One or two variables may be returned from this function, depending on the type of string group referenced.
value If the string group is configured for key value pair the string parameter is compared against the key, and the value is returned in the value variable. If the string group is not configured for key value pair the value variable will be nil.
match returns true if a match was found, or nil if no match.
|Version||v16.3 and later|
|Related||avi.ipgroup.contains() Matches an IP address against an IP group.
avi.stringgroup.beginswith() Matches if a string group entry begins with part of another string
avi.stringgroup.endswith() Matches if a string group entry ends with part of another string
avi.stringgroup.equals() Matches if a string group entry equals another string.
|Example||The following example must be used with a string group configured with key value pair enabled.