|Function||avi.stringgroup.equals( stringgroup, string )|
|Description||String groups are simple lists of string data. This function evaluates a custom string to see if it exactly matches an entry in the 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 key's value field.|
|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. To perform the case as sensitive, use the following syntax: avi.stringgroup.endswith_CASE( "stringgroup", "string")
Strarting with Avi Vantage 20.1.1, the String Group Datascript accepts String Group names as variables too.
|Returns||Two variables are always returned by this function.
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 still be returned, but its value will always be nil.
match returns true if a match is found, or false if there is no match.
|Version||v16.3 and later|
|Related||avi.ipgroup.contains() Matches an IP address against an IP group.
avi.stringgroup.contains() Matches if a string group entry contains part of another string.
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.
|Example 1||The following example checks if the userID is in an approved list before allowing access to the site. This is a case wherein we expect val to always return as nil.
|Example 2||This example redirects clients based on location embedded into the host header by moving the location into the beginning of the path. The following table illustrates the key / values stored in the string group. This is a case, wherein if match is true, we also expect val to contain the corresponding value.
sa.test.com/path/index.htm?query=1 will be redirected to www.test.com/sa/path/index.htm?query=1