mysql去空格trim_mysql去空格函数trim

一,mysql去除左空格函数:

ltrim(str)

returns the string str with leading space characters removed.

例子:

代码示例:

mysql> select ltrim(‘ barbar’);

-> ‘barbar’

this function is multi-byte safe.

二,mysql去除右空格函数:

rtrim(str)

returns the string str with trailing space characters removed.

例子:

代码示例:

mysql> select rtrim(‘barbar ‘);

-> ‘barbar’

this function is multi-byte safe.

三,trim函数可以过滤指定的字符串:

完整格式:trim([{both | leading | trailing} [remstr] from] str)

简化格式:trim([remstr from] str)

returns the string str with all remstr prefixes or suffixes removed. if none of the specifiers both, leading, or trailing is given, both is assumed. remstr is optional and, if not specified, spaces are removed.

例子:

代码示例:

你可能感兴趣的:(mysql去空格trim)