List of utility methods to do String Split by Separator
String[] | split(String str, char separatorChar, boolean preserveAllTokens) split if (str == null) { return null; int len = str.length(); if (len == 0) { return EMPTY_STRING_ARRAY; List<String> list = new ArrayList<String>(); ... |
String[] | split(String str, String separator) split if (str == null) { return null; if (separator == null || separator.length() != 1) { return null; int len = str.length(); if (len == 0) { ... |
String[] | split(String str, String separator) split String[] returnValue; int index = str.indexOf(separator); if (index == -1) { returnValue = new String[] { str }; } else { List<String> strList = new ArrayList<String>(); int oldIndex = 0; while (index != -1) { ... |
String[] | split(String str, String separator, boolean preserveEmptyToken) Split the string into tokens by the specified separator. List<String> list = new ArrayList<String>(); int start = 0, i = 0, len = separator.length(), total = str.length(); while ((i = str.indexOf(separator, start)) != -1) { if (start != i || preserveEmptyToken) { list.add(str.substring(start, i)); start = i + len; if (start != total || preserveEmptyToken) { list.add(str.substring(start, total)); return list.toArray(new String[list.size()]); |
String[] | split(String string, char separator) split List<String> tokens = new ArrayList<String>(); int idxBeforeComma = 0; for (int i = 0; i < string.length(); i++) { if (string.charAt(i) == separator) { tokens.add(string.substring(idxBeforeComma, i)); idxBeforeComma = i + 1; return tokens.toArray(new String[] {}); |
String[] | split(String strToSplit, String strSeparator, int iLimit) split java.util.ArrayList tmpList = new java.util.ArrayList(); int iFromIndex = 0; int iCurIndex = strToSplit.length(); String strUnitInfo = ""; int iCurCounts = 0; while ((iCurIndex != -1) && (iFromIndex <= strToSplit.length()) && (iCurCounts < iLimit)) { iCurIndex = strToSplit.indexOf(strSeparator, iFromIndex); if (iCurIndex == -1) { ... |
List | split(String text, String separators, String brackets) split List<String> result = new ArrayList<String>(); StringBuilder builder = new StringBuilder(); int length = text.length(); int bracketLevel = 0; for (int i = 0; i < length; i++) { char c = text.charAt(i); if (bracketLevel == 0 && separators.indexOf(c) != -1) { result.add(builder.toString()); ... |
String[] | splitAll(String str, char separatorChar) Splits the provided text into an array, separator specified. if (str == null) { return EMPTY_STRING_ARRAY.clone(); int len = str.length(); if (len == 0) { return EMPTY_STRING_ARRAY.clone(); List<String> list = new ArrayList<String>(); ... |
List | splitAndTrim(String tags, String separator) split And Trim List<String> result = new ArrayList<String>(); if (tags != null && tags.length() > 0) { for (String piece : tags.split(separator)) { if (hasText(piece)) { result.add(piece.trim()); return result; |
List | splitBySeparator(String path, String separator) split By Separator return Arrays.asList(path.split(separator.replace("\\", "\\\\"))); |