nko
03-03-2006, 05:33 PM
I've got a Ruby script. In my script, there is a string. In my string, there are letters, followed by a number followed by more letters. For example:
"line1ID"
-or-
"line33Name"
I'm trying to distill the number from within the string. I've gone through all the regexping and string-methoding I can find in any documentation and can't figure out an elegant way of turning that embedded integer in to a... well, and integer!
There are all kinds of elegant ways to solve all sorts of elegant problems in Ruby, so I can't believe that I'm going to have to define a function that performs voodoo on my strings to distill integers.
How do I get that number out of that string?
"line1ID"
-or-
"line33Name"
I'm trying to distill the number from within the string. I've gone through all the regexping and string-methoding I can find in any documentation and can't figure out an elegant way of turning that embedded integer in to a... well, and integer!
There are all kinds of elegant ways to solve all sorts of elegant problems in Ruby, so I can't believe that I'm going to have to define a function that performs voodoo on my strings to distill integers.
How do I get that number out of that string?