解码带有百分比符号 (%HH) 的十六进制字符串
Decode hex string with percentage symbol (%HH)
我需要更改字符串:
Fast-9%20|%20Speed%20(Something-Cool)
为此:
Fast-9 | Speed (Something-Cool)
如何在 NodeJS 中实现?
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));
试试这个:
var str = 'Fast-9%20|%20Speed%20(Something-Cool)';
str = str.replace(/%20/g, " ");
alert(str);
var decoded = decodeURIComponent("Fast-9%20|%20Speed%20(Something-Cool)");
我需要更改字符串:
Fast-9%20|%20Speed%20(Something-Cool)
为此:
Fast-9 | Speed (Something-Cool)
如何在 NodeJS 中实现?
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));
试试这个:
var str = 'Fast-9%20|%20Speed%20(Something-Cool)';
str = str.replace(/%20/g, " ");
alert(str);
var decoded = decodeURIComponent("Fast-9%20|%20Speed%20(Something-Cool)");