Skip to content

Instantly share code, notes, and snippets.

@emoralest
Created April 19, 2015 03:31
Show Gist options
  • Save emoralest/e5e7191821a57b702e2a to your computer and use it in GitHub Desktop.
Save emoralest/e5e7191821a57b702e2a to your computer and use it in GitHub Desktop.
Convert String to ArrayList. Ideal for simple adapters like spiners o listviews.
private ArrayList<String> splitToArrayList(String string) {
ArrayList<String> result = new ArrayList<String>();
if(string == null || string.trim().length() == 0)
return result;
//Pipes, in this case.
String[] split = string.split("[|]");
return new ArrayList<String>(Arrays.asList(split));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment