I've got a field in a mysql db that's a varchar(255). I've looked at trim() to remove leading and trailing whitespace, but it seems to only handle spaces, not tab characters:
UPDATE mytable SET textfield = TRIM(textfield);
Does anyone know how to also strip tabs off the start and end of a field?
The TRIM() function removes leading and trailing spaces from a string.
The TRIM() function returns a string that has unwanted characters removed. Note that to remove the leading spaces from a string, you use the LTRIM() function. And to remove trailing spaces from a string, you use the RTRIM() function.
You can still use the TRIM
function, and specify the character to be trimmed:
UPDATE mytable SET email = TRIM(CHAR(9) FROM TRIM(email));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With