comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: make strsplit not skip null between patterns
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: make strsplit not skip null between patterns [message #75190] Thu, 17 February 2011 15:43
Garfield is currently offline  Garfield
Messages: 2
Registered: February 2011
Junior Member
On Feb 17, 6:07 pm, Michael Galloy <mgal...@gmail.com> wrote:
> On 2/17/11 3:59 PM, Garfield wrote:
>
>
>
>
>
>
>
>
>
>> Hi all,
>> I am trying to use strsplit to extract data from a string. the string
>> is like this:
>
>> RD|I|04|013|9997|43202|10|1|078|142|20070813|02:00|0.00000|| ||
>> ND|||||||||||.31806
>
>> I am using '|' as the pattern of separator, so the statement is "data
>> = strsplit(line,'|', count=n, /extract)". I do this for thousands of
>> lines. The problem for me is that there is not always an input between
>> a pair of '|', so the dimensions of the 'data' returned by IDL are not
>> constant. I don't want this because every input in between a pair of
>> '|' has different meaning. I want to make the dimension of 'data' to
>> be constant so that I can easily know the meaning of each input.
>
>> Need ideas! Thanks,
>
>> Zhen
>
> Try the setting the PRESERVE_NULL keyword.
>
> Mike
> --www.michaelgalloy.com
> Research Mathematician
> Tech-X Corporation

Mike, thanks a lot! I missed this keyword, which is the last one on
the man page...

Garfield
Re: make strsplit not skip null between patterns [message #75191 is a reply to message #75190] Thu, 17 February 2011 15:17 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Michael Galloy writes:

> Try the setting the PRESERVE_NULL keyword.

So *that's* what PRESERVE_NULL means! ;-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: make strsplit not skip null between patterns [message #75192 is a reply to message #75191] Thu, 17 February 2011 15:07 Go to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 2/17/11 3:59 PM, Garfield wrote:
> Hi all,
> I am trying to use strsplit to extract data from a string. the string
> is like this:
>
> RD|I|04|013|9997|43202|10|1|078|142|20070813|02:00|0.00000|| ||
> ND|||||||||||.31806
>
> I am using '|' as the pattern of separator, so the statement is "data
> = strsplit(line,'|', count=n, /extract)". I do this for thousands of
> lines. The problem for me is that there is not always an input between
> a pair of '|', so the dimensions of the 'data' returned by IDL are not
> constant. I don't want this because every input in between a pair of
> '|' has different meaning. I want to make the dimension of 'data' to
> be constant so that I can easily know the meaning of each input.
>
> Need ideas! Thanks,
>
> Zhen

Try the setting the PRESERVE_NULL keyword.

Mike
--
www.michaelgalloy.com
Research Mathematician
Tech-X Corporation
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: make strsplit not skip null between patterns
Next Topic: Yesterday's Coyote Graphics Update

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:34:17 PDT 2025

Total time taken to generate the page: 0.00616 seconds