Changing space-formatted tables to tabs
Jay Schille
jayschille at gmail.com
Thu Mar 13 11:55:48 PDT 2008
I've got some weather information tables from the Web that are
formatted like so:
Seattle 60 40 61 / 10 30 100
Tacoma 58 42 60 / 10 40 100
Mercer Island 59 41 59 / 10 30 100
Woodinville 61 43 62 / 20 20 100
etc.
The records are separated by chr(13), but all the other gaps are empty spaces.
Is there any easy way to replace the gaps with tabs or some other
single delimiter, no matter how many spaces comprise the gap?
Something better than this:
local oWeatherTable /* the table above */
local x
x=1
loop
if array(oWeatherTable, x, chr(13)) contains " ",
array(oWeatherTable, x, chr(13))=replace(array(oWeatherTable,
x, chr(13)), " ", chr(9)
x=x+1
and so on, which can get pretty tedious covering all the
possibilities of gap size.
Any simplification of this process will be much appreciated.
--
Jay Schille
More information about the Qna
mailing list