Escaping in groovy

后端 未结 1 1540
半阙折子戏
半阙折子戏 2021-01-17 16:49

I need a help in escaping in groovy

I have some string in text file like this #$commonTomcat620.max_threads$# These value i have to replace in run

1条回答
  •  不要未来只要你来
    2021-01-17 17:43

    You have a couple of options to escape the dollar sign:

    This works (with dollar-slashy strings):

    def str = $/#\$$commonTomcat620.max_threads\$$#/$
    

    Or this (with single quote strings):

    def str = '#\\$commonTomcat620.max_threads\\$#'
    

    Other options probably exist too

    0 讨论(0)
提交回复
热议问题