1 | static L<S> splitCamelCasePlusUnderscores(S s) { |
2 | int j = 0; |
3 | new L<S> l; |
4 | |
5 | // new addition |
6 | if (isAllUpperCase(s)) ret l with l.add(s); |
7 | |
8 | for i over s: { |
9 | char last = charAt(s, i-1), c = s.charAt(i); |
10 | if (i > j && (isUpperCaseLetter(c) || last == '_' || c == '_')) { |
11 | l.add(substring(s, j, i)); |
12 | j = i; |
13 | } |
14 | } |
15 | if (j < l(s)) |
16 | l.add(substring(s, j)); |
17 | ret l; |
18 | } |
Began life as a copy of #1012527
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1022429 |
Snippet name: | splitCamelCasePlusUnderscores (keeps the underscores) |
Eternal ID of this version: | #1022429/3 |
Text MD5: | d43bd962b4b4f72272dd2b7b85296898 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-03-17 10:56:20 |
Source code size: | 410 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 261 / 292 |
Version history: | 2 change(s) |
Referenced in: | [show references] |