Could someone help me convert a string with a number in it such as “26.7
feet” to just the word, “feet”?
I’ve searched documentation without luck. Thank you!
Could someone help me convert a string with a number in it such as “26.7
feet” to just the word, “feet”?
I’ve searched documentation without luck. Thank you!
Hi –
On Fri, 2 May 2008, Jason L. wrote:
Could someone help me convert a string with a number in it such as “26.7
feet” to just the word, “feet”?I’ve searched documentation without luck. Thank you!
string[/\w+$/] would give you “feet”. A lot depends on how you define
the operation you want (last sequence of characters, everything after
last number, etc.).
David
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs