1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-15 11:14:17 +02:00

sub_str can handle undef

This commit is contained in:
Justin Lin
2019-06-16 17:42:17 +08:00
parent 0eb1387f27
commit 8a5956e852

View File

@@ -9,14 +9,13 @@
**/ **/
function _split_t_by(idxs, t) = function _split_t_by(idxs, t) =
let(end_i = len(idxs) - 1) let(leng = len(idxs))
concat( concat(
[sub_str(t, 0, idxs[0])], [sub_str(t, 0, idxs[0])],
[ [
for(i = 0; i < end_i; i = i + 1) for(i = 0; i < leng; i = i + 1)
sub_str(t, idxs[i] + 1, idxs[i + 1]) sub_str(t, idxs[i] + 1, idxs[i + 1])
], ]
sub_str(t, idxs[end_i] + 1)
); );
function split_str(t, delimiter) = function split_str(t, delimiter) =