【发布时间】:2013-11-12 03:14:49
【问题描述】:
我有一个包含很多数字的列表,例如:
1, 2, 3, 4, 5,
6, 7, 8, 9, 10,
...
如何逐行提取它们并进行一些计算? 类似(伪代码):
def f = new File("data.txt")
f.eachLine() {
println(it.findAll( /\d+/ )*.toInteger()*2)
}
我需要去掉逗号和空格。
【问题讨论】:
-
你快到了,你为什么停下来!? :P
标签: groovy