in reply to Re: split/map weirdness: empty strings vs undef
in thread split/map weirdness: empty strings vs undef
Thanks to all... yeah the code I posted was splitting on the wrong character (that was an error in the test case, not in the code I found the problem in). More importantly was the "By default, empty leading fields are preserved, and empty trailing ones are deleted" sentence that I've never noticed before ... I've dealt with records that had empty fields before without problems -- it never occursed to me that trailing blank fields would be treated differently.
Since I won't allways know how many total fields I should expect (I was planning on using the length of hte array returend by split) I can either count the pipes, or just put an extra bogus field on the end before splitting it, and then pop it off. ... not sure how i feel about that, seems a bit ... dirty.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: split/map weirdness: empty strings vs undef
by Aristotle (Chancellor) on Oct 04, 2002 at 22:26 UTC | |
by hossman (Prior) on Oct 04, 2002 at 22:34 UTC | |
by Aristotle (Chancellor) on Oct 05, 2002 at 18:01 UTC | |
|
Re: Re: Re: split/map weirdness: empty strings vs undef
by jsprat (Curate) on Oct 08, 2002 at 17:44 UTC | |
|
Re: Re: Re: split/map weirdness: empty strings vs undef
by sauoq (Abbot) on Oct 05, 2002 at 01:32 UTC | |
by blakem (Monsignor) on Oct 05, 2002 at 09:02 UTC |