views:

235

answers:

1

I want to convert my English Numbers Pager to an Arabic one, I had something like

<% @engnum = "0123456789" %>
<% @arabnum = "٠١٢٣٤٥٦٧٨٩" %>

<%= (@pagenumber).to_s.gsub(/./) {|s| @arabnum[@engnum.index(s)]} %>

But this shows the ascii number not the actual number i need

Any idea how to show the actual string (Number) Remember that it's arabic numbers and @arabnum[@engnum.index(s),1] didn't work

Thanks in advance

A: 

You should try

@pagenumber.to_s.gsub(/./) {|s| @arabnum[[email protected](s),i]}

For more information about this you should read http://ruby-doc.org/core/classes/String.html#M000771

jigfox