trim invisible chars

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.
severin [ Di, 16 Januar 2007 12:48 ] [ ID #1597374 ]

Re: trim invisible chars

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
Shion [ Di, 16 Januar 2007 12:59 ] [ ID #1597375 ]
PHP » alt.php.sql » trim invisible chars

Vorheriges Thema: Building shoping cart problem
Nächstes Thema: phptriad