DataScript: string.split
Note: This function is supported in Avi Vantage 18.2.5+.
Function | string.split (source_string, delimiter) source_string:split (delimiter) |
Description | Using a user-supplied delimiter, parses a string into substrings, and returns them in a Lua table of dimension equal to the number of substrings found. |
Events | All |
Parameter | source_string is the string to split. delimiter is a single character by which to parse source_string. |
Returns | If either source_string or delimiter is nil, returns NIL. Otherwise, returns a Lua table with elements corresponding to source_string, but split by each occurrence of delimiter. If there are no occurrences of delimiter in source_string, then the table returned will have only one element, the full string source_string. |
Examples | URI example
In the above example, split_results is a table containing:
Consequently, the character string "uri" will be logged in the request logs.Split miss example
Notes
|