unhex

description

Syntax

VARCHAR unhex(VARCHAR str)

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

example

  1. mysql> select unhex('@');
  2. +------------+
  3. | unhex('@') |
  4. +------------+
  5. | |
  6. +------------+
  7. mysql> select unhex('41');
  8. +-------------+
  9. | unhex('41') |
  10. +-------------+
  11. | A |
  12. +-------------+
  13. mysql> select unhex('4142');
  14. +---------------+
  15. | unhex('4142') |
  16. +---------------+
  17. | AB |
  18. +---------------+

keywords

  1. UNHEX