We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f6c27a7 commit e1260a3Copy full SHA for e1260a3
src/main/java/me/itzg/helpers/users/model/UserDef.java
@@ -15,8 +15,16 @@ public class UserDef {
15
final List<String> flags;
16
17
public UserDef(String input) {
18
- ArrayList<String> tokens = new ArrayList<String>(Arrays.asList(input.trim().split(":")));
19
- name = tokens.remove(0);
20
- flags = tokens;
+ final int colonIndex = input.trim().indexOf(':');
+ if (colonIndex < 0) {
+ name = input.trim();
21
+ flags = new ArrayList<>();
22
+ return;
23
+ }
24
+ name = input.substring(0, colonIndex).trim();
25
+ flags = Arrays.stream(input.substring(colonIndex + 1).split(","))
26
+ .map(String::trim)
27
+ .filter(flag -> !flag.isEmpty())
28
+ .toList();
29
}
30
0 commit comments