Skip to content

Commit

Permalink
feat: implement chunk (#2)
Browse files Browse the repository at this point in the history
iykekings authored Feb 21, 2020
1 parent d899e35 commit 1cec7b7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/LasCs.cs
Original file line number Diff line number Diff line change
@@ -169,7 +169,14 @@ public static string removeComment(string str)
.Select(val => val.TrimStart())
.Where(f => (f[0] != '#')));
}

// TODO: reimplement with Array.Copy
public static T[][] chunk<T>(T[] arr, int size)
{
int i = 0;
return arr.GroupBy(s => i++ / size).Select(g => g.ToArray()).ToArray();
}


}
}
}

0 comments on commit 1cec7b7

Please sign in to comment.