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中文網其他相關文章!