|
Posted by Jeff North on 09/13/07 21:59
On Thu, 13 Sep 2007 14:02:17 -0700, in comp.lang.php Anthony Smith
<mrsmithq@hotmail.com>
<1189717337.618895.272990@d55g2000hsg.googlegroups.com> wrote:
>| I am allowing the use to cut and paste comma delimited data. How do I
>| process the data one line at a time?
$lines = explode("\n", $data);
for($idx=0; $idx<count($lines); $idx++) {
$commas = explode(",", $lines[$idx]);
// do whatever
}
Note: you will obviously need to do more checking when exploding each
line. The data could look like:
123,"this is a line of text",123
123,"He said, 'this is a new sentence'.",123
The second example will return a length of 4.
-- -------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
-- -------------------------------------------------------------
Navigation:
[Reply to this message]
|