How can I parse a string with a comma thousand separator to a number?

This is useful when we need to do calculations based on the user input. For formatting the entered number in front end we add comma as thousand separator. But problem is when we try to parse it.