Hi All: I receive a decimal in string format and want to convert it to Integer in groovy. could not find any solution so far. For eg: I get the string value as "100.0" and I need the output as 100. Please help.
I plan to run this groovy script in boomi.
First convert to float, then to integer:
def s = "100.0"
def f = s.toFloat()
def i = f.toInteger() //or (int)f
or one line,
def i = "100.0".toFloat().toInteger()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With