Created
August 9, 2012 16:17
-
-
Save dancinllama/3305582 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Map<String,Set<String>> parseCsv(Integer numRecords){ | |
//csvFile is public Blob member variable... | |
String csvData = csvFile.ToString(); | |
csvData = csvData.replace('"',''); | |
List<String> records = csvData.split('\r?\n'); | |
Map<String,Set<String>> ans = ... | |
//Start at 1 to skip header row | |
for(Integer i=1; i < records.size() && (numRecords == null || i <= numRecords); i++){ | |
String [] columns = records.get(i).split(',',-1); | |
String accountNum = columns[0]; | |
String name = columns[1]; | |
String eligible = columns[2]; | |
String reason = columns[3]; | |
//Do other stuff | |
} | |
return ans; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Col1,Col2,Col3,Col4^MVal1,Val2,Val3,Val4^MVal5,Val6,Val7,Val8 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment