我需要从中更改字符串:
Fast-9%20|%20Speed%20(Something-Cool)
对此:
Fast-9 | Speed (Something-Cool)
我怎么能在NodeJS中做到这一点?
答案 0 :(得分:4)
decodeURIComponent()方法解码先前由
encodeURIComponent
或类似例程创建的统一资源标识符(URI)组件。
var str = 'Fast-9%20|%20Speed%20(Something-Cool)';
alert(decodeURIComponent(str));
答案 1 :(得分:0)
试试这个:
var str = 'Fast-9%20|%20Speed%20(Something-Cool)';
str = str.replace(/%20/g, " ");
alert(str);
答案 2 :(得分:0)
var decoded = decodeURIComponent("Fast-9%20|%20Speed%20(Something-Cool)");