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

10
LINES

< > BotCompany Repo | #1030346 // indentWidth

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

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

static int indentWidth(int spacesPerTab default 2, S s) {
  int count = 0, n = l(s);
  for i to n: {
    char c = s.charAt(i);
    if (c == ' ') ++count;
    else if (c == '\t') count += spacesPerTab;
    else break;
  }
  ret count;
}

Author comment

Began life as a copy of #1020372

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030346
Snippet name: indentWidth
Eternal ID of this version: #1030346/1
Text MD5: cbd038ed7bbd497e02da53bd1684c191
Transpilation MD5: 1e590e70bae85a239efa3321be565104
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-12-05 20:47:23
Source code size: 244 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 173 / 246
Referenced in: [show references]