But what if your addressee is Samuel Barber at Capricorn, Mt. Kisko, NY.
Or in the Brill Building at 1619 Broadway, Suite 511, New York, NY? Or = a
law firm such as Miller, Mertens & Comfort, P.L.L.C. ?
Excel will export these as
Samuel Barber,"Capricorn, Mt. Kisco",NY
Tin Pan Alley,"1619 Broadway, Suite 511", New York, NY
"Miller, Mertens & Comfort, P.L.L.C.","1020 North Center Parkway, Suite
B",Kennenwick,WA
Other systems might escape internal commas. Worse, grabbing rows from a
database and injecting commas between them, will lead to unparsable resul= ts.
There is no easy solution to this problem; you really have to parse on
well-formed input.
Bob Schaaf
On Jul 23, 2009, at 8:17 AM, Mirko Viviani wrote:
something similar...
fi =3D File.open("yourfile", "r")
#get key values
header =3D fi.gets.chomp.split(",")
allValues =3D []
while (!fi.eof)
values =3D fi.gets.chomp.split(",")
allValues << header.zip(values)
end
fi.close
puts allValues.inspect
2009/7/23 Hunt Hunt <
[email protected]>
Hi Friends,
I have a file which information.txt which is like
name,address,city,contact
abc,Newyork,HYU,345
xyz,Pittsurg,UYY,234
only theree line.
Now I have to split name, address,city & contact with their associated
values.
how am i supposed to do this?
Thanks for the information in advance.
Regards
HUNT/RUDIN
--
-- Mirko Viviani --
GPG-PGP Public Key: 0xE4E8FAB1
Fingerprint: 14D3 A373 E926 7737 DF32 502B A4C4 1CE2 E4E8 FAB1
***********************************************
"=93Machines take me by surprise with great frequency.=94 A. Turing