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

16
LINES

< > BotCompany Repo | #1012527 // ai_splitCamelCase

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

Libraryless. Click here for Pure Java version (2163L/14K).

static L<S> ai_splitCamelCase(S s) {
  int j = 0;
  new L<S> l;
  
  // new addition
  if (isAllUpperCase(s)) ret l with l.add(s);
  
  for i over s:
    if (i > j && isUpperCaseLetter(s.charAt(i))) {
      l.add(substring(s, j, i));
      j = i;
    }
  if (j < l(s))
    l.add(substring(s, j));
  ret l;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1012527
Snippet name: ai_splitCamelCase
Eternal ID of this version: #1012527/4
Text MD5: 6531b2515d38ddbee225f6eb531241f0
Transpilation MD5: 101074febbe7f4bfd3c368a08491be86
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-29 00:25:53
Source code size: 322 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 459 / 554
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1012833 - splitCamelCase - synonym of ai_splitCamelCase
#1022429 - splitCamelCasePlusUnderscores (keeps the underscores)