Skip to main content

Is there a more sophisticated way of removing backslash within a string? I've tried string.replace(/\\/g, ""), but that did not help.
 

JavaScript replace returns a new string rather than modifying the string you call it on, so you need to do something like: 

recordsri].value.name = recordsri].value.name.replace(/\\/g,"");

Note that if you are modifying field names rather than their values, you need to build a list of the old keys, a map of the new keys and their values, and then apply the changes. If you try to operate on the keys while looping through them, you'll get a ConcurrentModificationException


Reply