illegal string body character after dollar sign

前端 未结 4 1241
既然无缘
既然无缘 2020-12-25 14:33

if i define a groovy variable

def x = \"anish$\"

it will throw me error, the fix is

def x = \"anish\\$\"

4条回答
  •  自闭症患者
    2020-12-25 15:17

    You can use octal representation. the character $ represents 044 in octal, then:
    def x = 'anish\044'

    or
    def x = 'anish\044'

    For example, in Java i did use like this:
    def x = 'anish\044'

提交回复
热议问题