Created
April 19, 2015 03:31
-
-
Save emoralest/e5e7191821a57b702e2a to your computer and use it in GitHub Desktop.
Convert String to ArrayList. Ideal for simple adapters like spiners o listviews.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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