RE: [PHP] help with \n\r in strings



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: [PHP] 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
.



Relevant Pages

  • Problems with Map.size()..........
    ... with first column of string type and the others columns of double type. ... array of double. ... //System.out.println("Il numero di colonne del file ...
    (comp.lang.java.programmer)
  • Re: Two results of set geometry
    ... There is such an order preserving bijection" ... If we take the null string to be string of 0 length, ... 1's which can be projected on the first column but there is no finite ... The first column is a denumerable sequence of 1's. ...
    (sci.math)
  • Bug in Excel 2007 using Ranges/Names?
    ... I'm writing an Excel Add-In using Visual Studio 2008. ... a range for each of the first 300 cells in the first column. ... the value of the cell is set to a string ("blahx" ... private Office.CommandBar MainMenuBar; ...
    (microsoft.public.excel.programming)
  • Re: Two results of set geometry
    ... There is such an order preserving bijection" ... If we take the null string to be string of 0 length, ... 1's which can be projected on the first column but there is no finite ... The first column is a denumerable sequence of 1's. ...
    (sci.math)
  • RE: [PHP] First Character In A String
    ... www.dwsasia.com - company web site ... [PHP] First Character In A String ...
    (php.general)