Libraryless. Click here for Pure Java version (2431L/16K).
1 | static LS stringToChunksWithOverlap(S s, int chunkLength, int overlap) { |
2 | assertTrue(overlap < chunkLength); |
3 | assertTrue(chunkLength > 0); |
4 | int n = l(s), i = 0; |
5 | new LS out; |
6 | while (i < n) { |
7 | out.add(substring(s, i, i+chunkLength)); |
8 | i += chunkLength-overlap; |
9 | } |
10 | ret out; |
11 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1029088 |
Snippet name: | stringToChunksWithOverlap |
Eternal ID of this version: | #1029088/1 |
Text MD5: | fdef196039c5dce5dff21d329150e32c |
Transpilation MD5: | 01afb1b2653819ddf241161139f624b5 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-19 02:55:51 |
Source code size: | 297 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 226 / 346 |
Referenced in: | [show references] |