|Function||avi.stringgroup.endswith( stringgroup, string )|
|Description||String groups are simple lists of string data. This function evaluates a custom string to see if it ends with an entry in the string group that matches. 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.
The string comparison returns true upon the shortest match. If the string group has entries for a, ab, abc, and the evaluated string is 'xxxab', the function will match the 'ab' 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. 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||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 false if 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.equals() Matches if a string group entry equals another string.
|Example||The following example checks if the URL's path ends with an approved type, such as .html, .png, .css. Other file types not in the list are discarded. This example uses the standard string list, rather than the key value pair.