Source
static List<String> tokenizeFieldValue(String headerValue) { List<String> tokens = new List<String>(); int start = 0; int index = 0; while (index < headerValue.length) { if (headerValue[index] == ",") { tokens.add(headerValue.substring(start, index)); start = index + 1; } else if (headerValue[index] == " " || headerValue[index] == "\t") { start++; } index++; } tokens.add(headerValue.substring(start, index)); return tokens; }