2019独角兽企业重金招聘Python工程师标准>>>
用","分隔
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?
小额赞助
交个朋友,一起交流Java技术