Groovy adds several methods to the String class to see if the string value is a number. We can check for all kind of number type like Integer, Double, BigDecimal and more.
assert '42'.isNumber() assert '42'.isInteger() && '42'.isLong() && '42'.isBigInteger() assert '42.42'.isDouble() && /42.42/.isBigDecimal() && '42.42'.isFloat()