Efficient way to split an array of strings. [message #56818] |
Wed, 14 November 2007 17:10 |
bberkey
Messages: 2 Registered: November 2007
|
Junior Member |
|
|
I have a lot of data that comes to me in tabular files with a nice mix
of strings and numerical data. Typically I will read the data into a
string array. And then loop over each line in the file calling
STRSPLIT repeatably.
Is there a better way to accomplish this?
Thanks
-Ben Berkey
Example data
3401601.15, 5 TRACK
3401601.20, 5 TRACK
3401601.25, 5 TRACK
3401601.26, 5 TRACK
My code
token = " "
count = 3
i = long64(0)
tot = n_elements(array)
splitarray = strarr(count,tot)
while(i LT tot) do begin
splitarray[i*count] = strsplit(array[i],token,/extract)
i = i +1
endwhile
|
|
|