0

Is there a standard function to remove the junk symbols in the text var a= "CWC%20-%20Maint%20Eng%20-%20El" which is instead to be displayed as CWC - Maint Eng - El

user894795
  • 145
  • 1
  • 2
  • 11

1 Answers1

0

you can use replace function, and make the string replace as a global, check here JsFiddle

var str = 'CWC%20-%20Maint%20Eng%20-%20El';
str = str.replace(/%20/g, " ");
console.log(str);

or you can use decodeURIComponent method

var str = 'CWC%20-%20Maint%20Eng%20-%20El';
var de_str = decodeURIComponent(str);
console.log(de_str);
nisar
  • 1,055
  • 2
  • 11
  • 26