The list of methods to do String Split by Line are organized into topic(s).
String[]
fastSplit(final String line, final char c) Splits a string using a character.
int nextSplit = line.indexOf(c);
if (nextSplit < 0) {
return new String[] { line };
final List<String> splits = new ArrayList<String>();
int lastSplit = -1;
while (nextSplit > 0) {
splits.add(line.substring(lastSplit + 1, nextSplit));
...
String[]
split(String line) This method splits a single CSV line into junks of String .
List<String> results = new ArrayList<>();
StringBuffer buffer = new StringBuffer(line);
while (buffer.length() > 0) {
if (buffer.indexOf("\"") == 0) {
int endIndex = buffer.indexOf("\"", 1);
String result = buffer.substring(1, endIndex);
results.add(result);
buffer.delete(0, endIndex + 2);
...
String[]
split(String line) split
List<String> args = new ArrayList<String>();
boolean quote = false;
StringBuffer arg = new StringBuffer();
for (int i = 0; i < line.length(); i++) {
char c = line.charAt(i);
if (c == '"') {
quote = !quote;
continue;
...
ArrayList
split(String line, char delimiter)
split
int prevPos = 0;
ArrayList<String> tokens = new ArrayList<String>();
final int len = line.length();
for (int index = 0; index < len; ++index) {
if (line.charAt(index) == delimiter) {
tokens.add(line.substring(prevPos, index));
prevPos = index + 1;
tokens.add(line.substring(prevPos, len));
return tokens;
String[]
split(String line, String regex) split
List<String> strings = new ArrayList<String>();
String part = "";
for (int i = 0; i < line.length() - (regex.length() - 1); i++) {
if (line.substring(i, i + regex.length()).equalsIgnoreCase(regex)) {
strings.add(part);
part = "";
i = i + regex.length() - 1;
} else {
...