`
boogie
  • 浏览: 233327 次
  • 性别: Icon_minigender_1
  • 来自: 宁波
社区版块
存档分类
最新评论

Groovy字符串替换一例

阅读更多

将param替换成paramValue

 

def queryContent = "select * from query where id=${param}"
def regex = '\\$\\{param\\}'
def matcher = (queryContent =~ /${regex}/)
queryContent = matcher.replaceAll('paramValue')

 

参考: http://docs.codehaus.org/display/GROOVY/Tutorial+5+-+Capturing+regex+groups  

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics