字符串编码,解码

用的时候总想起不来,记个笔记。
encodeURIComponent() 函数可把字符串作为 URI 组件进行编码。

encodeURIComponent(URIstring)
encodeURIComponent('http://localhost:8000/pointCloudPlat');
//===>
// http%3A%2F%2Flocalhost%3A8000%2FpointCloudPlat

decodeURIComponent() 函数可对 encodeURIComponent() 函数编码的 URI 进行解码。

decodeURIComponent(URIstring)
decodeURIComponent('http%3A%2F%2Flocalhost%3A8000%2FpointCloudPlat');
//===>
// http://localhost:8000/pointCloudPlat
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章