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
- that
$has special meaning in double quoted strings literals"", calledgstring. - in groovy, can user regex literal, using better using regex multiple escape sequences in string.
Comments
Post a Comment