groovy replace double quotes with single and single with double -


i have string "['type':'multipolygon', 'coordinates':[[73.31, 37.46], [74.92, 37.24]]]"

how can replace single quotes double quotes , double single? result should this: '["type":"multipolygon", "coordinates":[[73.31, 37.46], [74.92, 37.24]]]'

from link given @yate, can find method:

tr(string sourceset, string replacementset) 

and apply string as:

def yourstring = ... def changedstring = yourstring.tr(/"'/,/'"/) 

that job.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -