append_trailing_char_if_absent

description

Syntax

VARCHAR append_trailing_char_if_absent(VARCHAR str, VARCHAR trailing_char)

如果’s’字符串非空并且末尾不包含’c’字符,则将’c’字符附加到末尾。 trailing_char只包含一个字符,如果包含多个字符,将返回NULL

example

  1. MySQL [test]> select append_trailing_char_if_absent('a','c');
  2. +------------------------------------------+
  3. | append_trailing_char_if_absent('a', 'c') |
  4. +------------------------------------------+
  5. | ac |
  6. +------------------------------------------+
  7. 1 row in set (0.02 sec)
  8. MySQL [test]> select append_trailing_char_if_absent('ac','c');
  9. +-------------------------------------------+
  10. | append_trailing_char_if_absent('ac', 'c') |
  11. +-------------------------------------------+
  12. | ac |
  13. +-------------------------------------------+
  14. 1 row in set (0.00 sec)

keyword

APPEND_TRAILING_CHAR_IF_ABSENT