RE: help with \n\r in strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try:

$string_as_array = explode("\n", $string);

echo "<pre>";
print_r($string_as_array);
echo "</pre>";

The array that you get will contain segments of the string that is separated
with \n. Let me know if that helps. 

Best regards,
Peter Lauri

www.dwsasia.com  - company web site
www.lauri.se  - personal web site
www.carbonfree.org.uk  - become Carbon Free

-----Original Message-----
From: Angelo Zanetti [mailto:angelo@xxxxxxxxxxxx] 
Sent: Friday, December 29, 2006 10:43 AM
To: PHP List
Subject:  help with \n\r in strings

Hi all,

I receive a text file with a whole bunch of strings. and each line is 
terminated by what I presume is \n\r however when I read the string into 
PHP, it seems that the last column of the row and the first column of 
the next row are connected but it appears as a space but I've done all 
kinds of tests like $spacePos = strrpos($dateAmount, ' '); but this is 
always empty.

So is there a way to test for \r\n? or what else can I use to delimit 
these two values (last column of row and first column of next row)?

Thanks in advance.

Angelo
                                       
-- 
------------------------------------------------------------------------
Angelo Zanetti
Systems developer
------------------------------------------------------------------------

*Telephone:* +27 (021) 469 1052
*Mobile:*       +27 (0) 72 441 3355
*Fax:*            +27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* angelo@xxxxxxxxxxxx <mailto:angelo@xxxxxxxxxxxx>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux