标签:
Split a string into an array of substrings:
示例:
var str = "How are you doing today?"; var res = str.split(" ");
The result of res will be an array with the values:
结果:
How,are,you,doing,today?
示例
var str = "How are you doing today?"; var res = str.split();
结果:
How are you doing today?
示例:
var str = "How are you doing today?"; var res = str.split("");
结果:
H,o,w, ,a,r,e, ,y,o,u, ,d,o,i,n,g, ,t,o,d,a,y,?
示例:
var str = "How are you doing today?"; var res = str.split(" ",3);
结果:
How,are,you
示例:
var str = "How are you doing today?"; var res = str.split("o");
结果:
H,w are y,u d,ing t,day?
标签:
原文地址:http://my.oschina.net/snowbobo/blog/414678