trim invisible chars

trim invisible chars

am 16.01.2007 12:48:55 von severin

Hi all,

I try "update mybase set name = trim(name)"

to skip spaces.

But 'charriot return'
(\13\10) are always here.

How can i remove ( or select ) all invisible characteres??

Thx.

Re: trim invisible chars

am 16.01.2007 12:59:12 von Shion

severin wrote:
> Hi all,
>
> I try "update mybase set name = trim(name)"
>
> to skip spaces.
>
> But 'charriot return'
> (\13\10) are always here.
>
> How can i remove ( or select ) all invisible characteres??

The placement of the "whitespaces" are important when using trim(), it takes
only those that are in the beginning or/and end of the string.

so if you have a string like, "hello\n\rThis is my string", trim will give you
the string "hello\n\rThis is my string" as the charterers in question are in
the middle of the string.

http://www.php.net/manual/en/function.trim.php


If you want to trim characters in the middle of a string, you may want to use
something like eregi_replace().

$newstring=eregi_replace("\n\r",'',"hello\n\rThis is my string");
// $newstring="helloThis is my string"

http://www.php.net/manual/en/function.eregi-replace.php


--

//Aho