Salesforce Apex read CSV file data which has comma in it

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('"')) {
} else if (field.startsWith('"')) {
makeCompositeField = true;
compositeField = field;
} else if (field.endsWith('"')) {
compositeField += ',' + field;
makeCompositeField = false;
} else if (makeCompositeField) {
compositeField += ',' + field;
} else {


Customer testmonimal

AdhiSoft’s deep expertise helps our clients to take advantage of everything Salesforce platform offers and move quickly to go live usage. Our AdhiSoft solution was delivered in lesser time, almost one third of time of traditional platform solutions.

Prospective Client from US

We are very aggressive about coming with new solution for our business need, AdhiSoft delivered the right mix of and
custom development expertise. They helped us with Salesforce solutions for our requirement, Salesforce allows us to maintain a focus on our customer and to do it in a faster, simpler way.