Here is the wrong (job security) way:
String[] usernames = str.substring(1)
.split("=\\d+[,}]\\s*");
Why is this the wrong way? We are throwing out the stuff we don't want.
The first character (whatever it is), and hoping that "=#, " and "=#}" is the only stuff we don't want.
If the string began with "{ tchristofferson=10", then the first username would get a leading space.
The better way is to match the stuff you do want. And now that I'm not trying to create the answer on an iPhone screen, here it is:
String input = "{tchristofferson=10, mchristofferson=50}";
Pattern USERNAME_VALUE = Pattern.compile("(\\w+)=(\\d+)");
Matcher matcher = USERNAME_VALUE.matcher(input);
ArrayList<String> list = new ArrayList<>();
while(matcher.find()) {
list.add(matcher.group(1));
}
String[] usernames = list.toArray(new String[0]);
This assumes each character of your usernames match the \w pattern (i.e., [a-zA-Z0-9_] and other alphanumeric Unicode code points). Modify if your username requirements are more/less restrictive.
(\w+) is used to capture the username as matcher.group(1), which is added to the list which is eventually turned into your String[].
(\d+) is also being used to capture the number associated with this user as matcher.group(2). This capture group is not (presently) being used, so you could remove the parenthesis for a small efficiency gain, i.e., "(\\w+)=\\d+". I included it in case you wanted to do something with those values as well.