本文整理匯總了Java中com.csvreader.CsvReader.setDelimiter方法的典型用法代碼示例。如果您正苦於以下問題:Java CsvReader.setDelimiter方法的具體用法?Java CsvReader.setDelimiter怎麽用?Java CsvReader.setDelimiter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.csvreader.CsvReader
的用法示例。
在下文中一共展示了CsvReader.setDelimiter方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: test10
import com.csvreader.CsvReader; //導入方法依賴的package包/類
@Test
public void test10() throws Exception {
String data = "1\r2\n";
CsvReader reader = CsvReader.parse(data);
reader.setDelimiter('\r');
Assert.assertTrue(reader.readRecord());
Assert.assertEquals("1", reader.get(0));
Assert.assertEquals("2", reader.get(1));
Assert.assertEquals(0L, reader.getCurrentRecord());
Assert.assertEquals(2, reader.getColumnCount());
Assert.assertEquals("1\r2", reader.getRawRecord());
Assert.assertFalse(reader.readRecord());
Assert.assertEquals("", reader.getRawRecord());
reader.close();
}
示例2: test16
import com.csvreader.CsvReader; //導入方法依賴的package包/類
@Test
public void test16() throws Exception {
String data = "\r\r\n1\r";
CsvReader reader = CsvReader.parse(data);
reader.setDelimiter('\r');
Assert.assertTrue(reader.readRecord());
Assert.assertEquals("", reader.get(0));
Assert.assertEquals("", reader.get(1));
Assert.assertEquals("", reader.get(2));
Assert.assertEquals(0L, reader.getCurrentRecord());
Assert.assertEquals(3, reader.getColumnCount());
Assert.assertEquals("\r\r", reader.getRawRecord());
Assert.assertTrue(reader.readRecord());
Assert.assertEquals("1", reader.get(0));
Assert.assertEquals("", reader.get(1));
Assert.assertEquals(1L, reader.getCurrentRecord());
Assert.assertEquals(2, reader.getColumnCount());
Assert.assertEquals("1\r", reader.getRawRecord());
Assert.assertFalse(reader.readRecord());
reader.close();
}