Convert string with comma to integer

Viewed 183424

Is there any neat method to convert "1,112" to integer 1112, instead of 1?

I've got one, but not neat:

"1,112".split(',').join.to_i #=> 1112
7 Answers
String count = count.replace(",", "");
Related