Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = "widget_1;widget_3;widget_2;|widget_5|"
- column = {}
- position = {}
- tmp_col = s.split("|")
- tmp_col.each_index do |i|
- tmp_pos = tmp_col[i].split(";")
- tmp_pos.each_index do |j|
- position[tmp_pos[j]] = j
- column[tmp_pos[j]] = i
- end
- end
- puts column["widget_5"]
- puts position["widget_5"]
- puts column["lol"]
- puts position["lol"]
Add Comment
Please, Sign In to add comment