字符串按位数截取成数组
作者:chrispy
var text = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' arrCutout(text) function arrCutout(text){ var arr = [] var newtext = '' for(var i = 1; i <= text.length; i++){ newtext = newtext + text.charA
var text = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
arrCutout(text)
function arrCutout(text){
var arr = []
var newtext = ''
for(var i = 1; i <= text.length; i++){
newtext = newtext + text.charAt(i - 1)
if(i % 5 == 0 ){
newtext += ','
}
}
arr = newtext.split(',')
return arr
}