Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
大家好:我收到一个字符串格式的小数,并希望将其转换为 groovy 中的整数。到目前为止找不到任何解决方案。例如:我得到的字符串值为“100.0”,我需要输出为 100。请帮忙。
我计划在 boomi 中运行这个 groovy 脚本。
首先转换为浮点数,然后转换为整数:
def s = "100.0" def f = s.toFloat() def i = f.toInteger() //or (int)f
或一行,
def i = "100.0".toFloat().toInteger()