Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1029088 // stringToChunksWithOverlap

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2431L/16K).

static LS stringToChunksWithOverlap(S s, int chunkLength, int overlap) {
  assertTrue(overlap < chunkLength);
  assertTrue(chunkLength > 0);
  int n = l(s), i = 0;
  new LS out;
  while (i < n) {
    out.add(substring(s, i, i+chunkLength));
    i += chunkLength-overlap;
  }
  ret out;
}

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: 127 / 201
Referenced in: [show references]