如果没有指定要截掉的字符,则默认为 空格;
trim一次只能截掉一种字符;
ltrim、rtrim一次可以截掉多种字符
1.trim
-
select trim(leading ',' from ',,,hello,,,') ltrim,
trim(trailing ',' from ',,,hello,,,') rtrim,
trim(both ',' from ',,,hello,,,') btrim1,
trim(',' from ',,,hello,,,') btrim2
from dual;
LTRIM RTRIM BTRIM1 BTRIM2
-------- -------- ------ ------
hello,,, ,,,hello hello hello
2.ltrim, rtrim
-
select ltrim('<=,,,hello,,,=>', '<=,') ltrim,
rtrim('<=,,,hello,,,=>', '>=,') rtrim
from dual;
LTRIM RTRIM
---------- ----------
hello,,,=> <=,,,hello
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7417681/viewspace-2027629/
,如需转载,请注明出处,否则将追究法律责任。