S
S
Stan_12014-10-07 00:22:48
ruby
Stan_1, 2014-10-07 00:22:48

How to convert a string to a number in Ruby?

The question may be stupid, and it's easy to implement it yourself, but it's always better to use the ways of those who have already gone through it. :)
So, there are several lines: for example, "the eighth of March", "the eighth of March", "the eighth people". Is there a gem for ruby ​​that can do at least:
"March 8th", "March 8th", "8 people",
and at the maximum:
"March 8th", "March 8th", "8th Human".
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Philipp, 2014-10-07
@zoonman

similar, but not quite https://github.com/yaroslav/russian/

R
Renat Ibragimov, 2014-10-09
@MpaK999

put gem 'russian'
and then write
<%= "count #{Russian.p(count, "thing", "things", "things")} %>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question