Re: Quick snippet to convert text files to unix based line endings

From: Date: Mon, 24 Mar 2003 20:58:12 +0000
Subject: Re: Quick snippet to convert text files to unix based line endings
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-140892@lists.php.net to get a copy of this message
At 20:36 24.03.2003, Mike Zornek said: --------------------[snip]-------------------- >I'm writing a little script that is parcing a excel generated csv file. >While all the users will be using windows I'd like to make it safe for all >file types. > >Any one have a quick snippet that I could use to convert a temp file to use >all \n based line endings for consistency? --------------------[snip]-------------------- $in = array("/\n\r/", "/\r\n/", "/\r/"); $out = array("\n", "\n", "\n"); $cleaned = preg_replace($in, $out, $dirty); -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#140892) next »