public static Set<String> split(String s) {
        if (s == null || s.isEmpty()) return Set.of();
        Set<String> b = new HashSet<>();
        for (String item : s.split("[\\s,]"))
            if ( ! item.isEmpty())
                b.add(item);
        return Set.copyOf(b);
    }
Splits a string on both space and comma
vespajlib/src/main/java/com/yahoo/text/StringUtilities.java