Re: FORMAT codes and tabs [message #15365] |
Mon, 10 May 1999 00:00 |
ashmall
Messages: 14 Registered: October 1998
|
Junior Member |
|
|
Great minds think alike Pavel - that's just what I've ended up doing
but I have to agree it's not very elegant at all.
Thanks for the response,
Justin
On Mon, 10 May 1999 09:30:55 -0600, Pavel Romashkin
<promashkin@cmdl.noaa.gov> wrote:
> I have to deal with wierd file formats all the time. I found it to be
> often easier to read the entire odd line into a string and then, using
> byte convertion, eliminate unneeded characters and separate the string
> into an array(s) of appropriate format. I have a simple code for
> splitting a string at:
> http://spot.colorado.edu/~romashki/idl/hc_str_to_arr.pro
> It will do just what you want: separate a string at spaces and eliminate
> one extra character of choice (tab in your case). It is not an elegant
> solution but sometimes it was the simpliest way to go. You'd have to
> place the output in proper places yourself but that's minor I think.
> Cheers,
> Pavel
>
> Justin Ashmall wrote:
>
>> Dear All,
>>
>> I'm having trouble reading in a text file with dates and times in the
>> form:
>> 11/10/99<tab><sp>16<sp>:<sp>47
>> where <tab> and <sp> represent tabs and spaces.
>> Sometimes the day/months are consist of only 1 char (e.g. 3/4/99). I
>> can write a separate FORMAT statement for each case but when I try to
>> use I0 to deal with both cases it doesn't work and it seems to be due
>> to the TAB char.
>
|
|
|
Re: FORMAT codes and tabs [message #15368 is a reply to message #15365] |
Mon, 10 May 1999 00:00  |
Pavel Romashkin
Messages: 166 Registered: April 1999
|
Senior Member |
|
|
I have to deal with wierd file formats all the time. I found it to be
often easier to read the entire odd line into a string and then, using
byte convertion, eliminate unneeded characters and separate the string
into an array(s) of appropriate format. I have a simple code for
splitting a string at:
http://spot.colorado.edu/~romashki/idl/hc_str_to_arr.pro
It will do just what you want: separate a string at spaces and eliminate
one extra character of choice (tab in your case). It is not an elegant
solution but sometimes it was the simpliest way to go. You'd have to
place the output in proper places yourself but that's minor I think.
Cheers,
Pavel
Justin Ashmall wrote:
> Dear All,
>
> I'm having trouble reading in a text file with dates and times in the
> form:
> 11/10/99<tab><sp>16<sp>:<sp>47
> where <tab> and <sp> represent tabs and spaces.
> Sometimes the day/months are consist of only 1 char (e.g. 3/4/99). I
> can write a separate FORMAT statement for each case but when I try to
> use I0 to deal with both cases it doesn't work and it seems to be due
> to the TAB char.
|
|
|