字符串編碼,解碼

用的時候總想起不來,記個筆記。
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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章