Hi all,
My problem is i have to remove the "~" value from the last end of
the
record, actually first i will read from the file, while reading the file
i have remove this "~"
1)LIN*EDIA000005*000000570*570*0697*RC*SHEPLER''S
EXCLU*100*SHEPLER''S
EXCLUSIVE*6042142403*SHEPLERS COGNAC HORNBACK CAIMAN
TAIL*20070719*20070719**02*724178914197******070
A**********************50384~
2)LIN*EDIA000005*000000570*570*0697*RC*SHEPLER''S
EXCLU*100*SHEPLER''S
EXCLUSIVE*6042142403*SHEPLERS COGNAC HORNBACK CAIMAN
TAIL*20070719*20070719**02*724178711291******110
A**********************50544~
3)LIN*EDIA000005*000000570*570*0697*RC*SHEPLER''S
EXCLU*100*SHEPLER''S
EXCLUSIVE*6042142403*SHEPLERS COGNAC HORNBACK CAIMAN
TAIL*20070719*20070719**02*764556826704******145
A**********************50684~
At th 3 line end , i want to remove the "~", but i don''t
which
command to use it. my coding is
f = File.open(test,"r")
@aa=f.read()
@a=@aa.split("~")
@a.each do |v|
@h=v.split("\*")
end
Actually why i want to remove the last record means, when i am viewing
in array , i will get one more extra empty record, otherwise please let
me know, how to avoid the extra record. thanks :)
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---