groovyshell - Syntax error in removing bad character in groovy -


hello have string a= " $ 2 187.00" . tried removing white spaces , bad characters a.replaceall("\\s","").replace("$","") . getting error impossible parse json response: syntaxerror: json.parse: bad escaped character how remove bad character in expression value becomes 2187.00.kindly me .thanks in advance

def = ' $ 2 187.00' a.replaceall(/\s/,"").replaceall(/\$/,"")  // or a.replaceall(/[\s\$]/,"") 

it should return 2187.00.

note

  1. that $ has special meaning in double quoted strings literals "" , called gstring.
  2. in groovy, can user regex literal, using better using regex multiple escape sequences in string.

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

.htaccess - Matching full URL in RewriteCond -