Javascript的解码/编码api

 

一、fromCharCode() 接受一个指定的 Unicode 值,而后返回一个字符串。

语法:String.fromCharCode(numX,numX,...,numX)函数

详细了解:http://www.w3school.com.cn/jsref/jsref_fromCharCode.asp编码

 

二、charCodeAt() 返回指定位置的字符的 Unicode 编码。返回值是 0 - 65535 之间的整数。spa

语法:stringObject.charCodeAt(index)code

详细了解:http://www.w3school.com.cn/jsref/jsref_charCodeAt.asp字符串

 

三、encodeURI() 把字符串做为 URI 进行编码。get

语法:encodeURI(URIstring)string

该方法不会对 ASCII 字母和数字进行编码,也不会对这些 ASCII 标点符号进行编码: - _ . ! ~ * ' ( ) 。语法

若是 URI 组件中含有分隔符,好比 ? 和 #,则应当使用 encodeURIComponent() 方法分别对各组件进行编码。方法

详细了解:http://www.w3school.com.cn/jsref/jsref_encodeuri.aspco

 

四、decodeURI()  对 encodeURI() 函数编码过的 URI 进行解码。

语法:decodeURI(URIstring)

详细了解:http://www.w3school.com.cn/jsref/jsref_decodeURI.asp

 

五、 encodeURIComponent() 把字符串做为 URI 组件进行编码。

语法:encodeURIComponent(URIstring)

详细了解:http://www.w3school.com.cn/jsref/jsref_encodeURIComponent.asp

 

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

语法:decodeURIComponent(URIstring)

详细了解:http://www.w3school.com.cn/jsref/jsref_decodeURIComponent.asp

 

 

此文为纯整理。会持续更新...

相关文章
相关标签/搜索