代码改变世界

javascrit string split escape()

2012-08-30 23:59  youxin  阅读(229)  评论(0)    收藏  举报

Split a string into an array of substrings:

string.split(separator,limit) limit表示最大的数组元素个数。

: If an empty string ("") is used as the separator, the string is split between each character.

Use a letter as a separator:

var str="How are you doing today?";
var n=str.split("o");

The result of n will be an array with the values:

H,w are y,u d,ing t,day?
 

The escape() function encodes a string.

This function makes a string portable, so it can be transmitted across any network to any computer that supports ASCII characters.