vendredi 18 septembre 2015

How to convert string to int to string again efficiently ruby

I may be walking a thin line with what constitutes a valid SO question here but...

What is the best way to convert a string to an int, add some value, then back to a string, in ruby?

(string.to_i+1).to_s 

feels wrong and ugly.

Aucun commentaire:

Enregistrer un commentaire