unhex

description

Syntax

VARCHAR unhex(VARCHAR str)

输入字符串,如果字符串长度为0或者为奇数,返回空串; 如果字符串中包含[0-9]、[a-z]、[A-Z]之外的字符,返回空串; 其他情况每两个字符为一组转化为16进制后的字符,然后拼接成字符串输出

example

1. mysql> select unhex('@');
2. +------------+
3. | unhex('@') |
4. +------------+
5. |            |
6. +------------+

8. mysql> select unhex('41');
9. +-------------+
10. | unhex('41') |
11. +-------------+
12. | A           |
13. +-------------+

15. mysql> select unhex('4142');
16. +---------------+
17. | unhex('4142') |
18. +---------------+
19. | AB            |
20. +---------------+

keyword

UNHEX