Skip to content

Commit 0324ff2

Browse files
committed
fix only has string and delimiter
1 parent fef3280 commit 0324ff2

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

JavaCSV-Reloaded/src/com/csvreader/CsvReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1238,7 +1238,7 @@ public boolean readRecord() throws IOException {
12381238
// check to see if we hit the end of the file
12391239
// without processing the current record
12401240

1241-
if (startedColumn || (delimiterLen = getColumnDelimiterLen(lastLetter)) != -1) {
1241+
if (startedColumn || delimiterLen != -1) {
12421242
if (delimiterLen != -1) {
12431243
endColumn(delimiterLen);
12441244
} else {

JavaCSV-Reloaded/src/test/com/csvreader/AllTests.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,4 +2418,26 @@ public void test180() throws Exception {
24182418

24192419
reader.close();
24202420
}
2421+
2422+
/**
2423+
* test without processing the current record
2424+
*/
2425+
@Test
2426+
public void test181() throws Exception {
2427+
CsvReader reader = CsvReader.parse("1,");
2428+
reader.setDelimiters(Arrays.asList(","));
2429+
2430+
Assert.assertTrue(reader.readRecord());
2431+
Assert.assertEquals(2, reader.getColumnCount());
2432+
Assert.assertEquals("1", reader.get(0));
2433+
2434+
reader = CsvReader.parse("1,|=:");
2435+
reader.setDelimiters(Arrays.asList(",|=:"));
2436+
2437+
Assert.assertTrue(reader.readRecord());
2438+
Assert.assertEquals(2, reader.getColumnCount());
2439+
Assert.assertEquals("1", reader.get(0));
2440+
2441+
reader.close();
2442+
}
24212443
}

README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ New abilities
3232
1. Supports strings as record and column delimiter.
3333
2. Multiple row and column delimiters can be set, and the logic between multiple delimiters is or.
3434

35-
useage:
35+
usage:
3636

3737
```java
3838
CsvReader reader = CsvReader.parse("1,|'\r\n,|a'\r\n2,|b\r,\n3,ac");

0 commit comments

Comments
 (0)