lionbarrage
2/27/2009 1:47:00 AM
On Feb 26, 4:51 am, Simon Krahnke <overl...@gmx.li> wrote:
> * lionbarrage <cmakali...@gmail.com> (08:11) schrieb:
>
> > I'm not too familiar with hashes but the code you wrote seems to be
> > doing it. Thank you so much!!
>
> Hashes are just like arrays, only the keys can be anything and not just
> integers.
>
> > How do i refer to a single element within a hash?
>
> Simply by sets['GREEK'], but that single element is anarray.
>
> > Let's say I want 11 for example. Would I do sets["GREEK"][3]?
>
> Yes, sets['GREEK'][1] should do.
>
> mfg, simon .... l
Thanks! I did:
sets.keys.each{|k|
print k, "|"
}
print "\n"
sets.values.each { |v|
pp v
}
which got me:
ALPHA|OMEGA|GAMMA|EPSILON|GREEK|BETA|
["1", "4"]
["2", "5", "9", "13", "5"]
["3", nil]
["7", "12", "10"]
["8", "", "11"]
["0", nil, "1"]
Is there a format function which will remove "" and change , to | ?
Thanks tons!