MySQL TRIM()函数用于从字符串中删除特定的后缀、前缀或两者。TRIM()函数的工作原理可以通过其语法来理解 −
TRIM([{BOTH | LEADING | TRAILING} [str_to_remove] FROM] string)
这里,
在这里,
mysql> Select TRIM(BOTH '0' FROM '0100'); +----------------------------+ | TRIM(BOTH '0' FROM '0100') | +----------------------------+ | 1 | +----------------------------+ 1 row in set (0.00 sec) mysql> Select TRIM(BOTH '**' from '**tutorialspoint.com**'); +------------------------------------------------+ | TRIM(BOTH '**' from '**tutorialspoint.com**') | +------------------------------------------------+ | tutorialspoint.com | +------------------------------------------------+ 1 row in set (0.00 sec) mysql> Select TRIM(Trailing '**' from '**tutorialspoint.com**'); +----------------------------------------------------+ | TRIM(Trailing '**' from '**tutorialspoint.com**') | +----------------------------------------------------+ | **tutorialspoint.com | +----------------------------------------------------+ 1 row in set (0.00 sec) mysql> Select TRIM(Leading '**' from '**tutorialspoint.com**'); +---------------------------------------------------+ | TRIM(Leading '**' from '**tutorialspoint.com**') | +---------------------------------------------------+ | tutorialspoint.com** | +---------------------------------------------------+ 1 row in set (0.00 sec)
以上是MySQL TRIM() 函数的用途是什么?的详细内容。更多信息请关注PHP中文网其他相关文章!