List of usage examples for org.apache.commons.csv CSVStrategy setIgnoreLeadingWhitespaces
public void setIgnoreLeadingWhitespaces(boolean ignoreLeadingWhitespaces)
From source file:uk.co.droidinactu.common.file.DelimitedFile.java
public ArrayList<String> convertLineToFields(String line) { // Log.w("DelimitedFile", "convertLineToFields converting line [" + line + // "] to fields"); ArrayList<String> alFields = new ArrayList<String>(); CSVStrategy csvStrat = new CSVStrategy(this.m_sDelimiter.charAt(0), '\"', '#'); csvStrat.setIgnoreLeadingWhitespaces(true); CSVParser csvParser = new CSVParser(new StringReader(line), csvStrat); String[][] st;//from ww w.jav a2s . co m try { st = csvParser.getAllValues(); for (String[] element : st) { for (int tokenNbr = 0; tokenNbr < element.length; tokenNbr++) { alFields.add(element[tokenNbr]); } } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return alFields; }