"Todd Gardner" <piir / earthlink.net> schrieb im Newsbeitrag
news:9b849915.0406130226.55984c4b / posting.google.com...
> Hello everyone,
>
> How can I read the following text from a .csv file into a 2D array?

What's the separator here, is it a space or a tab?

> Is there a prewritten routine allowing me not to have to parse the file
myself?
>
> CREDIT 20040505120000[0:GMT] PAYMENT - THANK YOU 1
> CREDIT 20040309120000[0:GMT] PAYMENT - THANK YOU 146.8
> CREDIT 20040329120000[0:GMT] PAYMENT - THANK YOU 1500
> CREDIT 20040409120000[0:GMT] PROFESSIONAL CAREER DEV 1082.05
> DEBIT 20040601120000[0:GMT] TARGET        00003236 -21.64
> DEBIT 20040502120000[0:GMT] TARGET        00003236 -113.32
> DEBIT 20040417120000[0:GMT] TARGET        00003236 -47.02
> CREDIT 20040327120000[0:GMT] TARGET        00003236 129.89
> DEBIT 20040326120000[0:GMT] USPS 0568370007 -8.85
> DEBIT 20040508120000[0:GMT] USPS 5654840286 -7.85
> DEBIT 20040510120000[0:GMT] USPS 5654840286 -12.55

AFAIR there is something on RAA, but it's not difficult to do it by hand:

records = []

while ( line = gets )
  records << line.chomp.split / /
end

Or, if you need conversions

records = []

while ( line = gets )
  rec = line.chomp.split / /

  rec.map! do |elem|
    case elem
      when /^[+-]?\d+$/
        elem.to_i
      when /^[+-]?\d+\.\d+$/
        elem.to_f
      else
        elem
    end
  end

  records << rec
end

etc.

    robert