text_routines
SYNOPSIS
Text routines: string operations
- decode_xml(): Decode XML characters in text.
- encode_xml(): Encode a given text for XML.
- extract_json_value(): Extract value from JSON notation via XPath.
- get_num_tokens(): Return number of tokens in delimited text.
- get_option(): Extract value from options dictionary based on key.
- hexcode_text(): Present a Hexadecimal table for given text's characters.
- json_to_xml(): Convert valid JSON to equivalent XML.
- like_to_rlike(): Convert a LIKE expression to an RLIKE (REGEXP) expression.
- mysql_qualify(): Return a qualified MySQL object name.
- prettify_message(): Outputs a prettified text message, one row per line in text
- replace_all(): Replaces characters in a given text with a given replace-text.
- replace_sections(): Search and replace text appearing between section start/end.
- split_token(): Return substring by index in delimited text.
- starts_with(): Checks whether given text starts with given prefix.
- strip_urls(): Strips URLs from given text, replacing them with an empty string.
- tokenize(): Outputs ordered result set of tokens of given text.
- trim_wspace(): Trim white space characters on both sides of text.
EXAMPLES
Calculate 64 bit CRC for some text:
mysql> SELECT common_schema.crc64('mysql') AS crc64; +---------------------+ | crc64 | +---------------------+ | 9350511318824990686 | +---------------------+
Use shorttime_to_seconds() to parse '2h', making for 2 hours:
mysql> SELECT shorttime_to_seconds('2h') as seconds; +---------+ | seconds | +---------+ | 7200 | +---------+
Extract value from dictionary:
mysql> SELECT get_option('{width: 100, height: 180, color: #ffa030}', 'height') AS result; +--------+ | result | +--------+ | 180 | +--------+