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

Re: multiple delimiters



In article <39C09FE1.C9E0B54@dkrz.de>, Martin Schultz <martin.schultz@dkrz.de> writes:
>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
>
Or, you can use my STRPARSE, which takes any number of delimiters.

Mati Meron                      | "When you argue with a fool,
meron@cars.uchicago.edu         |  chances are he is doing just the same"