Java Utililty Methods CSV String Split

List of utility methods to do CSV String Split

Description

The list of methods to do CSV String Split are organized into topic(s).

Method

ListcsvSplit(String csvLine)
csv Split
ArrayList<String> fields = new ArrayList<String>();
StringBuilder sb = new StringBuilder();
int state = 0;
char c;
for (int i = 0; i < csvLine.length(); i++) {
    c = csvLine.charAt(i);
    switch (state) {
    case 0:
...
String[]csvToArray(String s)
csv To Array
ArrayList<String> arraylist = new ArrayList<String>();
boolean flag = false;
boolean flag1 = true;
StringBuffer stringbuffer = new StringBuffer();
for (int i = 0; i < s.length(); i++) {
    char c = s.charAt(i);
    if (c <= ' ')
        flag = true;
...
String[]csvToTrimArray(CharSequence charsequence)
csv To Trim Array
ArrayList<String> arraylist = new ArrayList<String>();
StringBuffer stringbuffer = new StringBuffer();
int i = -1;
int j = 0;
for (int k = charsequence.length(); j < k; j++) {
    char c = charsequence.charAt(j);
    if (c == ',') {
        if (stringbuffer.length() > 0) {
...
ListgetContentsFromNumpyCSVString(String numpyString)
get Contents From Numpy CSV String
ArrayList<String[]> contents = new ArrayList<>();
String[] lines = numpyString.split("\n");
for (int i = 0; i < lines.length; i++) {
    contents.add(lines[i].split(","));
return contents;
ListgetCsvValues(String line)
get Csv Values
List<String> values = delimitedStringToList(line, ",");
return values;
ListgetValuesFromCSVString(String csvString)
get Values From CSV String
List<String> values = new ArrayList<String>();
String[] splitString = csvString.split(",");
for (String value : splitString) {
    values.add(value.trim());
return values;
ArrayListSplitCSV(String csv)
Split CSV
ArrayList<Integer> list = new ArrayList<Integer>();
csv = csv.trim();
if (csv.length() == 0) {
    return list;
try {
    for (String s : csv.split(",")) {
        s = s.trim();
...
String[]splitCSV(String inputString)
split CSV
ArrayList<String> stringList = new ArrayList<String>();
String tempString;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < inputString.length(); i++) {
    if (inputString.charAt(i) == '"') {
        i++;
        while (i < inputString.length()) {
            if (inputString.charAt(i) == '"' && inputString.charAt(i + 1) == '"') 
...
String[]splitCSV(String str)
split CSV
java.util.ArrayList<String> DynStrs = new java.util.ArrayList<String>();
char ch;
int lastbreak = 0;
String temp;
for (int i = 0; i < str.length(); i++) {
    ch = str.charAt(i);
    if (ch == 34) {
        if (str.charAt(i + 1) == 34) {
...
String[]splitCSV(String str)
split CSV
ArrayList<String> split = new ArrayList<String>();
int i = 0;
int quotes = 0;
int index = str.indexOf(",");
int start = 0;
int stop = str.length();
while (index != -1) {
    String temp = str.substring(0, index); 
...