42BV / CSVeed

Light-weight, easy-to-use Java-based CSV utility
Apache License 2.0
100 stars 22 forks source link

Inconsistant Column Index Base #44

Closed Brendandurkin closed 10 years ago

Brendandurkin commented 10 years ago

Class Column enforces Column indexes to be 1-based. but .... Lines contents are 0-based

Thus in class RowImpl String firstColumnName=rowImpl.getColumnName(1); String firstColumnValue=rowImpl.get(0);

which leads us to....

String secondColumnValue=rowImpl.get(firstColumnName);

the fix is probably to change the get call in RowImpl to..

@Override
public String get(int columnIndex) {
    return line.get(columnIndex-1);
}
robert-bor commented 10 years ago

Thanks, and I agree. Suggested change adopted.