I am getting data in a variable as ""Value""
. So, I want to remove quotes but only inner quotes.
I tried with this but it's not working.
var value = "fetchedValue";
value = value.replace(/\"/g, "");
Can anyone explain with an example?
expected = "Value"
Therefore, to remove single quote from string column, we can use gsub function by defining the single quote and replacing it with blank(not space) as shown in the below examples.
Use the String. replace() method to replace single with double quotes, e.g. const replaced = str. replace(/'/g, " ); . The replace method will return a new string where all occurrences of single quotes are replaced with double quotes.
To remove double quotes just from the beginning and end of the String, we can use a more specific regular expression: String result = input. replaceAll("^\"|\"$", ""); After executing this example, occurrences of double quotes at the beginning or at end of the String will be replaced by empty strings.
It's weird. Your solution should work.
Well, try this:
var value = "fetchedValue";
value = value.slice(1, -1);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With