[groovy] Converting a string to int in Groovy

The way to use should still be the toInteger(), because it is not really deprecated.

int value = '99'.toInteger()

The String version is deprecated, but the CharSequence is an Interface that a String implements. So, using a String is ok, because your code will still works even when the method will only work with CharSequence. Same goes for isInteger()

See this question for reference : How to convert a String to CharSequence?

I commented, because the notion of deprecated on this method got me confuse and I want to avoid that for other people.