|
Posted by Janwillem Borleffs on 09/28/56 11:49
Mad Hatter wrote:
> I'm trying to replace characters in a string but getting totally
> confused. I want to strip \r off the end of a string. Example,
> sometext\r and I want to remove the \r
> I've tried the following variations plus a few others :-
>
> $testname=eregi_replace('\r',"",$testname);
> $testname=eregi_replace('\\r',"",$testname);
> $testname=eregi_replace('[\r]',"",$testname);
>
Using the POSIX or PCRE based functions is overhead for simple replacements;
simply apply the str_replace function:
$testname = str_replace("\r", '', $testname);
JW
Navigation:
[Reply to this message]
|