Reputation: 61
I need to change string from this:
Fast-9%20|%20Speed%20(Something-Cool)
To this:
Fast-9 | Speed (Something-Cool)
How can I do it in NodeJS?
Upvotes: 1
Views: 593
Reputation: 5126
var decoded = decodeURIComponent("Fast-9%20|%20Speed%20(Something-Cool)");
Upvotes: 0
Reputation: 3733
Try this:
var str = 'Fast-9%20|%20Speed%20(Something-Cool)';
str = str.replace(/%20/g, " ");
alert(str);
Upvotes: 0
Reputation: 36609
Refer decodeURIComponent
The decodeURIComponent() method decodes a Uniform Resource Identifier (URI) component previously created by
encodeURIComponent
or by a similar routine.
var str = 'Fast-9%20|%20Speed%20(Something-Cool)';
alert(decodeURIComponent(str));
Upvotes: 4