MySQL RTRIM函数


本MySQL教程将学习如何使用MySQL RTRIM函数。

描述

MySQL RTRIM函数将删除字符串右侧的所有空格字符。

语法

MySQL中RTRIM函数的语法为:

1
RTRIM( string )
参数 说明
string 要删掉右侧空格的字符串

示例

MySQL RTRIM函数示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
-- 空格
mysql> SELECT RTRIM('sea evergreen ');
Result: 'sea evergreen'
-- 只删掉右侧的空格
mysql> SELECT RTRIM(' abc ');
Result: ' abc'
-- tab键 也属于空白符号
mysql> SELECT RTRIM('igiftidea.com ');
Result: 'igiftidea.com'
-- 转义符\t 表示tab键也属于空白符
mysql> SELECT RTRIM('igiftidea.com \t');
Result: 'igiftidea.com'


原文链接:https://codingdict.com/