From: Robert Klemme Date: 2005-11-17T21:37:18+09:00 Subject: Re: extracting lines from an address Kris Leech wrote: > I have an address stored in mysql as a text field. > I'm using ActiveRecord to access the field. > But how do I get each line of the address in to their own strings? > > eg. > > Address = "12, HouseName > Street > City > Country" > > --> > > Address_line1 = "12, HouseName" > Address_line2 = "Street" > Address_line3 = "City" > Address_line4 = "Country" >> adr = "12, HouseName Street City Country" => "12, HouseName\n Street\n City\n Country" >> adr.to_a.each {|s| s.strip! } => ["12, HouseName", "Street", "City", "Country"] Kind regards robert