[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiple delimiters



nrh@imag.wsahs.nsw.gov.au wrote:
> 
> Has anyone nutted out a way to read ASCII files with multiple
> delimiters? Our current solution involves some messy string operations
> that are restricted to 5.3, and I/O operations we would like to avoid.
> Am I asking the impossible?
> 
> Sent via Deja.com http://www.deja.com/
> Before you buy.

1. Read the file line by line as strings
2. use my StrRepl function to replace all delimiters with one value
   e.g.  
     line = StrRepl(line, ';',' ')
     line = StrRepl(line, ',',' ')
     line = StrRepl(line, ':',' ')
3. Use ReadS, Str_Sep or StrSplit (5.3) to extract the numbers.
Caution: With Str_Sep or StrSplit you should always add a
StrTrim(StrCompress(line),2) before

You can find StrRepl at
http://www.mpimet.mpg.de/~schultz.martin/idl/html/libmartin_schultz.html

Cheers,
Martin

-- 
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
[[ Dr. Martin Schultz   Max-Planck-Institut fuer Meteorologie    [[
[[                      Bundesstr. 55, 20146 Hamburg             [[
[[                      phone: +49 40 41173-308                  [[
[[                      fax:   +49 40 41173-298                  [[
[[ martin.schultz@dkrz.de                                        [[
[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[