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

Andy Lester andy at petdance.com
Tue Feb 24 13:29:22 CST 2004

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

More information about the Chicago-talk mailing list