|
Posted by Chuck Anderson on 07/28/06 20:01
Bertie Brink wrote:
> I am trying to read comma delimited rows of text. The problem is that
> some fields may be encapsulated in "" - particularly the text fields but
> not numeric fields.
>
> Is there a simple efficient way to parse the fields with comma but also
> strip off the "" encapsulating some of the fields with php?
>
> The problem is the "" encapsulation is optional. Some fields will have
> it, some won't.
>
> Thanks
>
Once you have parsed out a field, use:
trim($field, '"'); (that's single quote - double quote - single quote)
.... which will remove " from the beginning and end of $field, if present.
--
*****************************
Chuck Anderson • Boulder, CO
http://www.CycleTourist.com
*****************************
Navigation:
[Reply to this message]
|