On May 26, 2008, at 10:14 PM, notnorwegian / yahoo.se wrote:

> i have 2 strings, i want to take for each char in string1 the same
> indexed char in string2 and make them into a key->value pair.
>
> how can i iterate a string?


something like this?

 >> s1 = "asdf"
=> "asdf"
 >> s2 = "bnmd"
=> "bnmd"
 >> arr = s1.split(//).zip(s2.split(//))
=> [["a", "b"], ["s", "n"], ["d", "m"], ["f", "d"]]
 >> h = Hash[*arr.flatten]
=> {"a"=>"b", "d"=>"m", "f"=>"d", "s"=>"n"}

regards,
-- 
Rolando Abarca M.