There appear to be some good solutions here, but I thought I'd jump in with a bit of non-Rails technical detail.
I'd double check with the source of this data - the zeros may be significant. (see http://en.wikipedia.org/wiki/Significant_figures) The data given doesn't seem to match that (482.600 mm would be written as 19.0000"), but it doesn't hurt to verify... --Matt Jones On Feb 27, 2:47 pm, northband <[email protected]> wrote: > Hi - > > I would like to use gsub() to strip decimals with trailing zeros from > a string. My string looks like this: > -- > 19.0 " / 482.600 mm > -- > > I would like to end up with this: > -- > 19 " / 482.6 mm > -- > > Anyone have a regular expression that can do this? > > Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

