ruby - conver string number to float -


i have string:

"3,8" 

i float this:

3.8 

you can using string#tr method:

"3,8".tr(',', '.').to_f   # => 3.8 

Comments

Popular posts from this blog

Line ending issue with Mercurial or Visual Studio -

tags - Jquery Mixitup plugin help prevent handlers being destroyed -

c# - Delving into the world of XML (Windows Phone) Error I dont understand (The ' ' character, hexadecimal value 0x20, cannot be included in a name.) -