note 69321 deleted from function.str-replace by bobby
| From: | bobby@php.net | Date: | Fri, 22 Sep 2006 15:01:52 +0000 |
| Subject: | note 69321 deleted from function.str-replace by bobby | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-117432@lists.php.net to get a copy of this message | ||
Note Submitter: fatidik
----
I came up with my own solution to get rid of newline characters. The one on this site is good but
this one just gets rid of newline character regardless of which one it is (might be \r\n, \n\r, \n
or \r) and replaces it just once (no double replace in case of double newline character (\r\n and
\n\r).
//Replaces newline characters in $sString with $sReplace
function str_repl_nline($sReplace, $sString) {
return str_replace(array("\r\n", "\n\r", "\n", "\r"),
$sReplace, $sString);
}
Enjoy