DataScript: avi.stringgroup.beginswith
DataScript
Function | avi.stringgroup.beginswith( stringgroup, string ) |
Description | String groups are simple lists of string data. This function evaluates a custom string to see if it begins 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 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 'abc', the function will match the 'a' since it is the shortest valid match. |
Events | HTTP_REQ HTTP_RESP |
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.beginswith_CASE( "stringgroup", "string") Starting with Avi Vantage 20.1.1, the String group Datascript accepts String Group names as variables too. For example, client = avi.http.get_header(“SessionID”)
|
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.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.
|
Starting with Avi Vantage 20.1.1, the String group Datascript accepts String Group names as variables too.
For example, StringGroup="abc"
val, match = avi.stringgroup.beginswith("StringGroup", client)