Skip to content

Commit e1260a3

Browse files
committed
fix: use comma to split flags instead of colon
1 parent f6c27a7 commit e1260a3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/main/java/me/itzg/helpers/users/model/UserDef.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@ public class UserDef {
1515
final List<String> flags;
1616

1717
public UserDef(String input) {
18-
ArrayList<String> tokens = new ArrayList<String>(Arrays.asList(input.trim().split(":")));
19-
name = tokens.remove(0);
20-
flags = tokens;
18+
final int colonIndex = input.trim().indexOf(':');
19+
if (colonIndex < 0) {
20+
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();
2129
}
2230
}

0 commit comments

Comments
 (0)