List of utility methods to do String Split by Delimiter
String[] | fastSplit(String string, char delimiter) Splits a String based on a single character, which is usually faster than regex-based String.split(). List<String> list = new ArrayList<String>(); int size = string.length(); int start = 0; for (int i = 0; i < size; i++) { if (string.charAt(i) == delimiter) { if (start < i) { list.add(string.substring(start, i)); } else { ... |
String[] | fastSplit(String string, String delimiter) fast Split return fastSplit(string, delimiter, true);
|
String[] | split(final boolean enable, final String value, final char delimiter) A version of the splitter commonly used by rest services in Graphene. String[] values; if (enable) { values = split(value, delimiter); } else { values = new String[] { value }; return values; |
List | split(final String input, final char delimiter) split return split(input, delimiter, false);
|
String[] | split(final String input, final String delimiter, final boolean removeEmpty) Implementation of a non regex-based string splitting utility. if (input.length() > 0) { final ArrayList<String> parts = new ArrayList<String>(); int beginIndex = 0, endIndex; while ((endIndex = input.indexOf(delimiter, beginIndex)) != -1) { parts.add(input.substring(beginIndex, endIndex)); beginIndex = endIndex + delimiter.length(); parts.add(input.substring(beginIndex)); ... |
String[] | split(final String src, final char delim) Preserves null sections. final ArrayList<String> output = new ArrayList<String>(); int index = 0; int lindex = 0; while ((index = src.indexOf(delim, lindex)) != -1) { output.add(src.substring(lindex, index)); lindex = index + 1; output.add(src.substring(lindex)); ... |
String[] | split(final String str, final char delim) split final List<String> tokens = new ArrayList<>(); final char[] charArray = str.toCharArray(); final StringBuffer token = new StringBuffer(); for (int i = 0; i < charArray.length; i++) { if (charArray[i] == delim) { tokens.add(token.toString()); token.setLength(0); } else { ... |
String[] | split(final String str, final String delimiter) Split string into separate tokens. List<String> tokens = new ArrayList<String>(); int p = 0; while (p < str.length()) { int q = str.indexOf(delimiter, p); if (q < 0) { q = str.length(); if (p == q) { ... |
String[] | split(String a, String delim) split if ("".equals(a)) return new String[0]; int position = 0; int delimiterIdx = 0; int strLen = a.length(); List<String> resultList = new ArrayList<String>(); int len = delim.length(); while (position <= strLen) { ... |
String[] | split(String input, char delimiter) Splits a string into an array using a provided delimiter. if (input == null) throw new NullPointerException("input cannot be null"); List<String> tokens = new ArrayList<String>(); StringTokenizer st = new StringTokenizer(input, new String(new byte[] { (byte) delimiter })); while (st.hasMoreTokens()) { tokens.add(st.nextToken().trim()); return tokens.toArray(new String[tokens.size()]); ... |