keyvalue
The keyvalue function is used to split the string str by split1, then split each group into key-value pairs by split2, and return the value corresponding to the specified key.
Syntax
keyvalue(string <str>,[string <split1>,string <split2>,] string <key>)
Parameters
Table 1 Parameter descriptions
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| str | Yes | STRING | The string to be split. |
| split1, split2 | No | STRING | The strings used as delimiters. The source string is split according to the two specified delimiters. If these two items are not specified in the expression, the default split1 is ; and split2 is :. When a string split by split1 contains multiple split2 characters, the return result is undefined. |
| key | Yes | STRING | After splitting the string by split1 and split2, returns the value corresponding to the key value. |
Return Values
Returns STRING type.
- If split1 or split2 is NULL, NULL is returned.
- If str or key is NULL, or if no matching key is found, NULL is returned.
- If there are multiple key-value matches, the value corresponding to the first matching key is returned.
Example Code
Returns 2.
select keyvalue('a:1;b:2', 'b'); What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot