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

11
LINES

< > BotCompany Repo | #1035336 // tokenRangeLongerThanNChars

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

Libraryless. Click here for Pure Java version (117L/1K).

1  
sbool tokenRangeLongerThanNChars(LS tok, int iStart, int iEnd, int maxChars) {
2  
  int nChars = 0, n = l(tok);
3  
  iStart = Math.max(0, iStart);
4  
  iEnd = Math.min(n, iEnd);
5  
  for (int i = iStart; i < iEnd; i++) {
6  
    nChars += l(tok.get(i));
7  
    if (nChars > maxChars)
8  
      true;
9  
  }
10  
  false;
11  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035336
Snippet name: tokenRangeLongerThanNChars
Eternal ID of this version: #1035336/1
Text MD5: d656c681d48a739c040248d03ab9f8fa
Transpilation MD5: f5760de8a4cbcfbdb6f77f8618736fe5
Author: stefan
Category: javax / tokenizing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-01 17:55:55
Source code size: 301 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 158 / 190
Referenced in: [show references]