[Chicago-talk] Problems with split (removing trailing fields)

Jay Strauss me at heyjay.com
Tue Feb 24 13:49:05 CST 2004


Thanks Andy,  I read that but it didn't give me the impression that is would
preserve trailing fields

Jay
----- Original Message -----
From: "Andy Lester" <andy at petdance.com>
To: "Chicago.pm chatter" <chicago-talk at mail.pm.org>
Sent: Tuesday, February 24, 2004 1:29 PM
Subject: Re: [Chicago-talk] Problems with split (removing trailing fields)


> On Tue, Feb 24, 2004 at 01:24:48PM -0600, Jay Strauss (me at heyjay.com)
wrote:
> > Hi,  I'm trying to parse a data stream whose delimiter is a chr(0).  The
> > problem is split " By default, empty leading fields are preserved, and
empty
> > trailing ones are deleted."  Basically, I'm loosing data that I need.
>
> Yes, if you want the final fields preserved, you set the third parm to
> split to a negative number.
>
>
>     If LIMIT is specified and positive, it represents the maximum number
of
>     fields the EXPR will be split into, though the actual number of fields
>     returned depends on the number of times PAT- TERN matches within EXPR.
>     If LIMIT is unspecified or zero, trailing null fields are stripped
>     (which potential users of "pop" would do well to remember).  If LIMIT
>     is negative, it is treated as if an arbitrarily large LIMIT had been
>     specified.  Note that splitting an EXPR that evaluates to the empty
>     string always returns the empty list, regardless of the LIMIT
specified.
>
> --
> Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at mail.pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
>
>




More information about the Chicago-talk mailing list