Replacing zeros after period : I have a string a="1,2,3,4.2300" I need to replace the last two zeros which follows after '.' for an example, it has to replace the values this way. 

    If "1,2,3,4.2300" then
        1,2,3,4.23
    If "1,2,3,4.20300" then
        1,2,3,4.203

How could I do this in Ruby? I tried with converting into Float but it terminates the string when I encounter a ','. Can I write any regular expression for this? 