[]
The context provides the zero-based row and column indexes of the CSV cell being parsed, together with the original cell text before the custom parser changes the parsed result.
CsvOpenOptions options = new CsvOpenOptions();
options.setParser(new ICsvParser() {
public void Parse(CsvParseResult result, CsvParseContext context) {
if (context.getColumn() == 0 && context.getText().startsWith("00")) {
result.setValue(context.getText());
}
}
});
workbook.open("path/to/data.csv", options);
CsvParseContext(int row,
int column,
String text) row - The zero-based row index of the current cell.column - The zero-based column index of the current cell.text - The original text of the current cell.
CsvOpenOptions options = new CsvOpenOptions();
options.setParser(new ICsvParser() {
public void Parse(CsvParseResult result, CsvParseContext context) {
int row = context.getRow();
if (row > 0) {
result.setValue(context.getText());
}
}
});
workbook.open("path/to/data.csv", options);
CsvOpenOptions options = new CsvOpenOptions();
options.setParser(new ICsvParser() {
public void Parse(CsvParseResult result, CsvParseContext context) {
int column = context.getColumn();
if (column == 0 && context.getText().startsWith("00")) {
result.setValue(context.getText());
}
}
});
workbook.open("path/to/data.csv", options);
CsvOpenOptions options = new CsvOpenOptions();
options.setParser(new ICsvParser() {
public void Parse(CsvParseResult result, CsvParseContext context) {
String text = context.getText();
if (text.startsWith("00")) {
result.setValue(text);
}
}
});
workbook.open("path/to/data.csv", options);