oracle中的trim函数

 trim('字符1' from '字符串2') ,字符1只能是单个字符。

1. trim()删除字符串两边的空格。
2. ltrim()删除字符串左边的空格。
3. rtrim()删除字符串右边的空格。
4. trim('字符1' from '字符串2') 分别从字符2串的两边开始,删除指定的字符1。
5. trim([leading | trailing | both] trim_char from string) 从字符串String中删除指定的字符trim_char。
leading:从字符串的头开始删除。
trailing:从字符串的尾部开始删除。
borth:从字符串的两边删除。
6. tim()只能删除半角空格。

For example:
trim(' tech ') would return 'tech';
trim(' ' from ' tech ') would return 'tech';
trim(leading '0' from '000123') would return '123';
trim(trailing '1' from 'Tech1') would return 'Tech';
trim(both '1' from '123Tech111') would return '23Tech';

猜你喜欢

转载自www.cnblogs.com/Mellita/p/11286538.html