Prev: check if a file is already required ?
Next: How to print out all of an object's instance variables?
From: KingMaker KingMaker on 19 May 2010 04:08 Text file: firstName=abcd lastName=xyz legalName=test vendorRepWorkPhone=121212 email=abcd(a)test.com confirmEmail=abcd(a)test.com First i read the file and get all values in the data variable. contents = File.read("c:/test/Flow1.txt") data = contents.map do |line| line.chomp.split("=")[1] end than put values in the variable like. @FirstName= @LastName= @LegalName= @VendorRepWorkPhone= @Email=data @ConFirmEmail= i use array for copy the values like data[0] for first line data[1] for second line but it is not good if i have 100 value than i write this for 100 times in the feature requirement is changed and add some field that time. problem arise so plz help me.. what is the best solution of this.... -- Posted via http://www.ruby-forum.com/.
|
Pages: 1 Prev: check if a file is already required ? Next: How to print out all of an object's instance variables? |