1. 程式人生 > >指令碼--Groovy 遍歷字串(62)

指令碼--Groovy 遍歷字串(62)

def chineseWithBlackSpace=""

for(c in userOrderNo){
    if(('0' <= c ) && ('9' >= c)){
        chineseWithBlackSpace +=c
    }else{
        chineseWithBlackSpace += " "+c
    }
}
println chineseWithBlackSpace

execution.setVariable("chineseWithBlackSpace", chineseWithBlackSpace);