On Wed, Apr 13, 2011 at 6:08 PM, Pieter Hugo <[email protected]> wrote:

> Hi
>
> Does anyone know of a quick way to convert human (string) numbers to
> integers?
>
> I doesnt need to be too fancy - the simple integers up to ten ( 10 :)
> will do.
>
> Id prefer not to install a plugin or gem - so the solution is not native
> to rails the possibly a '.collect' type algorithm?
>
>
hmm.. i don't know of any but i'd create a method that goes like

def num_word_to_int(string

 
['zero','one','two','three','four','five','six','seven','eight','nine','ten'].rindex
string
end


> Thanks for reading this!
>
> Pieter
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to