parse_kvs¶
Description¶
Returns an object of key=value pairs extracted from an input string.
The optional kvseparator
string argument allows you to specify a string of up to 256 ASCII key value separator characters other than the equals symbol, such as semicolon ‘;’, or colon ‘:’, depending on what your input data requires. Each character in the string will be treated as a separate valid kv separator. Emoji and other utf-8 separators are currently not supported. The default key value separator is the equal symbol ‘=’.
The optional delimiter
string argument allows you to specify a string of up to 256 ASCII key value pair delimiter characters other than comma, such as space ‘ ‘, tab ‘\t’ or pound ‘#’, depending on what your input data requires. Each character in the string will be treated as a separate valid delimiter. Emoji and other utf-8 delimiters are currently not supported. The default delimiters are comma, space, new line and tab ‘, \n\t’.
parse_kvs
is generally used with make_col
to make an object column that contains each of the values that come out of the input.
Return type¶
object
Domain¶
This is a scalar function (calculates a single output value for a single input row.)
Categories¶
Usage¶
parse_kvs(value, [ kvseparator ], [ delimiter ])
Argument |
Type |
Optional |
Repeatable |
Restrictions |
---|---|---|---|---|
value |
string |
no |
no |
none |
kvseparator |
string |
yes |
no |
constant |
delimiter |
string |
yes |
no |
constant |
Examples¶
make_col keyvals:parse_kvs(log)
Make a new object column ‘keyvals’ that contains key=value pairs extracted from string column ‘log’
make_col keyvals:parse_kvs(log, "%:", "#")
Make a new object column ‘keyvals’ that contains key value pairs extracted from string column ‘log’ with the the character percent ‘%’ and the character colon ‘:’ as individual key value separators and the character pound ‘#’ as the key value delimiter.
Aliases¶
parsekvs
(deprecated)