Skip to content

Commit

Permalink
fix #2227 读取csv文件时autoTrim配置失效
Browse files Browse the repository at this point in the history
  • Loading branch information
fufeiii authored May 6, 2022
1 parent bcb108f commit 52bcc43
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ private void dealRecord(CSVRecord record, int rowIndex) {
Map<Integer, Cell> cellMap = new LinkedHashMap<>();
Iterator<String> cellIterator = record.iterator();
int columnIndex = 0;
Boolean autoTrim = csvReadContext.currentReadHolder().globalConfiguration().getAutoTrim();
while (cellIterator.hasNext()) {
String cellString = cellIterator.next();
ReadCellData<String> readCellData = new ReadCellData<>();
Expand All @@ -105,7 +106,7 @@ private void dealRecord(CSVRecord record, int rowIndex) {
// csv is an empty string of whether <code>,,</code> is read or <code>,"",</code>
if (StringUtils.isNotBlank(cellString)) {
readCellData.setType(CellDataTypeEnum.STRING);
readCellData.setStringValue(cellString);
readCellData.setStringValue(autoTrim ? cellString.trim() : cellString);
} else {
readCellData.setType(CellDataTypeEnum.EMPTY);
}
Expand Down

0 comments on commit 52bcc43

Please sign in to comment.