function DivideStringIntoNSizeParts(str, N_size) {
return str.match(new RegExp('.{1,' + N_size + '}', 'g'));
}
const str = "node.js c++ python php c# go";
const N_size = 5;
const parts_arr = DivideStringIntoNSizeParts(str, N_size);
if (parts_arr != null) {
for (let i = 0; i < parts_arr.length; i++) {
console.log(parts_arr[i]);
}
}
/*
run:
node.
js c+
+ pyt
hon p
hp c#
go
*/