List of utility methods to do String to List
List | convertToList(String[] array) A method to convert a String array to a List of Strings ArrayList<String> list = new ArrayList<String>(); Collections.addAll(list, array); return list; |
List | stringsToList(final String[] src) strings To List if (src == null || src.length == 0) { return null; final List<String> result = new ArrayList<String>(); for (int i = 0; i < src.length; i++) { result.add(src[i]); return result; ... |
List | stringToArrayList(String idString) string To Array List return Arrays.asList(idString.trim().split("\\s*" + "," + "\\s*")); |
void | stringToBooleanList(final String str, final boolean[] listData) Convert a string into an array of booleans. if ((str == null) || (str.length() < 1) || (str.indexOf('1') < 0)) { java.util.Arrays.fill(listData, false); return; final int len = str.length(); for (int i = 0; i < 6; ++i) { if (i < len) { listData[i] = (str.charAt(i) == '1'); ... |
List | stringToIntegerList(String input) string To Integer List List<Integer> ret = new ArrayList<Integer>(); String prepared = input.replaceAll(" ", ""); for (String s : prepared.split(",")) { ret.add(Integer.valueOf(s)); return ret; |
String[] | stringToItems(List Convert a list of array of string into a single array of string, ready to be inserted into a combo List<String> itemsList = new ArrayList<String>(); for (int index = 0; index < fontsList.size(); index++) { String[] fonts = fontsList.get(index); for (String element : fonts) itemsList.add(element); if (index + 1 != fontsList.size() && fonts.length > 0 && useSeparator) itemsList.add(separator); String[] result = new String[itemsList.size()]; return itemsList.toArray(result); |
ArrayList | stringToList(final String string) Create a list with the given string for execution return new ArrayList<String>() { add(string); }; |
List | stringToList(String content) string To List if (content == null) { return new ArrayList<String>(); content = content.replace("\r", ""); String[] listArray = content.split("\n"); List<String> returnList = new ArrayList<String>(); for (String element : listArray) { returnList.add(element); ... |
List | stringToList(String content, String splitter) split the string to tokens by splitter List<String> list = new ArrayList<String>(); String[] segs = content.split(splitter); for (String seg : segs) { list.add(seg.trim()); return list; |
List | stringToList(String delimitedString) Converts a comma delimited String into a List List<String> result = new ArrayList<String>(); try { for (String s : Arrays.asList(delimitedString.split(","))) { result.add(s.trim()); } catch (Exception e) { result = new ArrayList<String>(); return result; |