Re: add to words syntaxes


#1

Hi!
Sorry for me, I’ve puted the lines what you wrote but it can be, that to
wrong place or something, because I can’t bring it to life. Would you
please look for it? Ive attach my script…
Regards:

Daniel


#2

On Fri, 2006-03-17 at 20:54 +0900, Dani wrote:

Hi!
Sorry for me, I’ve puted the lines what you wrote but it can be, that to
wrong place or something, because I can’t bring it to life. Would you
please look for it? Ive attach my script…

If I had to do this quickly (and without too much thought) I’d do
something like this:

def process(text_data, &blk)
text_data.split(/^$/m).each do |e|
dta = e.strip.gsub(/;$/,’’).split(/\n/)
yield *(dta.slice!(0…5) + [dta])
end
end

Which you’d then use like this:

process(File.read(‘teszt.data’)) do |ny, ne, ados, adoa, to, ig,
columns|
puts “#{ny} :: #{ne} :: #{ados} :: #{adoa} :: #{to} :: #{ig}”
p columns
end

=> 0608A :: Teszt Kft :: 33445566222 :: :: 20060101 :: 20060131

[“0A0001C002A 33445566222”, “0A0001C007A Teszt kft”]

0608M :: Oscar Wild :: 123456789 :: :: 20060101 :: 20060131

[“0A0001C002A 33445566222”, “0A0001C007A Teszt kft”]

Obviously you’d change the output to suit your needs. Bear in mind I’ve
not extensively tested this…