10032007 1027 GMT-6 DST

Well, that was a little easier than I had thought. Here I was thinking, 
"How do I change the character from ascii to something useable. Duh! 
Didnt think about the \n.

Thanks for simplifying it for me.

Wade

[EMAIL PROTECTED] wrote:
> ----- Original Message ----- 
> From: "Wade Smart" 
> 
> 10022007 2035 GMT-6 DST
> 
> Im searching a string for a certain character:
> Dec Hx Oct Char
> 10  A  012  LF
> 
> What I need to do is remove it. I have six lines that keep reoccurring. 
> I get the length and then find the character. If it happens that a 
> character is at then or beginning I can do a l or rtrim but Im a little 
> stumped on removing it from the middle.
> 
> Wade
> --------------------------------
> $my_string = str_replace("\n", "", $my_string);
> Will remove all LF's
> 
> Some notes - 
> Dec Hex Oct ASCII PHP
> 10  0A  012  LF  "\n"
> 13  0D  015  CR  "\r"
> 
> Windows uses "\r\n"
> Linux/UNIX uses "\n"
> Mac uses "\r"
> 
> To get to a standard (\n) from all formats - 
> $mystring = str_replace("\r", "\n", $my_string);
> to remove all double line feeds - 
> while(strpos($my_string, "\n\n") != FALSE)
>   {
>   $my_srting = str_replace("\n\n", "\n", $my_string);
>   }
> 
> If white space is important then do it this way - 
> $mystring = str_replace("\r\n", "\n", $my_string);
> $mystring = str_replace("\r", "\n", $my_string);
> In english
> CRLF becomes LF
> CR becomes LF
> $my_srting is now UNIX / Linux format
> To convert to windows - 
> $mystring = str_replace("\n", "\r\n", $my_string);
> To convert to Mac
> $mystring = str_replace("\n", "\r", $my_string);
> 
> 
> 
> Community email addresses:
>   Post message: [email protected]
>   Subscribe:    [EMAIL PROTECTED]
>   Unsubscribe:  [EMAIL PROTECTED]
>   List owner:   [EMAIL PROTECTED]
> 
> Shortcut URL to this page:
>   http://groups.yahoo.com/group/php-list 
> Yahoo! Groups Links
> 
> 
> 
> 

Reply via email to