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

codeigniter - Fatal error: Call to undefined function lang() in CI Merchant using CardSave -

javascript - CasperJS/PhantomJS failing SSL handshakes on some sites even with --ssl-protocol=any -

python - Received unregistered task using Celery with Django -