Skip to content

Instantly share code, notes, and snippets.

@dtulig
Created October 8, 2011 02:37
Show Gist options
  • Save dtulig/1271776 to your computer and use it in GitHub Desktop.
Save dtulig/1271776 to your computer and use it in GitHub Desktop.
final String stringToSplit = "dave ,john,, matt";
final Iterable<String> result = Splitter.on(",")
.omitEmptyStrings()
.trimResults()
.split(stringToSplit);
// Result: ["dave", "john", "matt"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment