List> allFields = new List>();
Blob contentFile;
String nameFile;
String[] filelines = new String[] {};
nameFile = contentFile.toString();
filelines = nameFile.split('\n');

for (Integer i = 1; i < filelines.size(); i++) { //for(String line : filelines) { //String[] inputvalues = new String[] {}; List fields = filelines[i].split(',');

// check for blank CSV lines (only commas)
//if (line.replaceAll(',','').trim().length() == 0)
// break;

List cleanFields = new List();
String compositeField;
Boolean makeCompositeField = false;
for(String field : fields) {

if (field.startsWith('"') && field.endsWith('"')) {
cleanFields.add(field.replaceAll('"',''));
} else if (field.startsWith('"')) {
makeCompositeField = true;
compositeField = field;
} else if (field.endsWith('"')) {
compositeField += ',' + field;
cleanFields.add(compositeField.replaceAll('"',''));
makeCompositeField = false;
} else if (makeCompositeField) {
compositeField += ',' + field;
} else {
cleanFields.add(field.replaceAll('"',''));
}

}
allFields.add(cleanFields);
}
}