Remove org.apache.commons.csv.CSVParser.parseString(String).
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1511868 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
65f6f1dfe8
commit
a36bbffdd3
|
@ -160,19 +160,6 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
|
||||||
return parseURL(url, charset, format);
|
return parseURL(url, charset, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a parser for the given {@link String} using the default format {@link CSVFormat#DEFAULT}.
|
|
||||||
*
|
|
||||||
* @param string
|
|
||||||
* a CSV string
|
|
||||||
* @return a new parser
|
|
||||||
* @throws IOException
|
|
||||||
* If an I/O error occurs
|
|
||||||
*/
|
|
||||||
public static CSVParser parseString(String string) throws IOException {
|
|
||||||
return parseString(string, CSVFormat.DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a parser for the given {@link String}.
|
* Creates a parser for the given {@link String}.
|
||||||
*
|
*
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class CSVParserTest {
|
||||||
{"world", ""}
|
{"world", ""}
|
||||||
};
|
};
|
||||||
for (final String code : codes) {
|
for (final String code : codes) {
|
||||||
final CSVParser parser = CSVParser.parseString(code);
|
final CSVParser parser = CSVParser.parseString(code, CSVFormat.DEFAULT);
|
||||||
final List<CSVRecord> records = parser.getRecords();
|
final List<CSVRecord> records = parser.getRecords();
|
||||||
assertEquals(res.length, records.size());
|
assertEquals(res.length, records.size());
|
||||||
assertTrue(records.size() > 0);
|
assertTrue(records.size() > 0);
|
||||||
|
@ -269,7 +269,7 @@ public class CSVParserTest {
|
||||||
{"a\\", "b"}, // a backslash must be returnd
|
{"a\\", "b"}, // a backslash must be returnd
|
||||||
{"a\\\\,b"} // backslash in quotes only escapes a delimiter (",")
|
{"a\\\\,b"} // backslash in quotes only escapes a delimiter (",")
|
||||||
};
|
};
|
||||||
final CSVParser parser = CSVParser.parseString(code);
|
final CSVParser parser = CSVParser.parseString(code, CSVFormat.DEFAULT);
|
||||||
final List<CSVRecord> records = parser.getRecords();
|
final List<CSVRecord> records = parser.getRecords();
|
||||||
assertEquals(res.length, records.size());
|
assertEquals(res.length, records.size());
|
||||||
assertTrue(records.size() > 0);
|
assertTrue(records.size() > 0);
|
||||||
|
@ -408,7 +408,7 @@ public class CSVParserTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCarriageReturnEndings() throws IOException {
|
public void testCarriageReturnEndings() throws IOException {
|
||||||
final String code = "foo\rbaar,\rhello,world\r,kanu";
|
final String code = "foo\rbaar,\rhello,world\r,kanu";
|
||||||
final CSVParser parser = CSVParser.parseString(code);
|
final CSVParser parser = CSVParser.parseString(code, CSVFormat.DEFAULT);
|
||||||
final List<CSVRecord> records = parser.getRecords();
|
final List<CSVRecord> records = parser.getRecords();
|
||||||
assertEquals(4, records.size());
|
assertEquals(4, records.size());
|
||||||
}
|
}
|
||||||
|
@ -416,7 +416,7 @@ public class CSVParserTest {
|
||||||
@Test
|
@Test
|
||||||
public void testLineFeedEndings() throws IOException {
|
public void testLineFeedEndings() throws IOException {
|
||||||
final String code = "foo\nbaar,\nhello,world\n,kanu";
|
final String code = "foo\nbaar,\nhello,world\n,kanu";
|
||||||
final CSVParser parser = CSVParser.parseString(code);
|
final CSVParser parser = CSVParser.parseString(code, CSVFormat.DEFAULT);
|
||||||
final List<CSVRecord> records = parser.getRecords();
|
final List<CSVRecord> records = parser.getRecords();
|
||||||
assertEquals(4, records.size());
|
assertEquals(4, records.size());
|
||||||
}
|
}
|
||||||
|
@ -426,7 +426,7 @@ public class CSVParserTest {
|
||||||
final String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n";
|
final String code = "\nfoo,baar\n\r\n,\n\n,world\r\n\n";
|
||||||
//String code = "world\r\n\n";
|
//String code = "world\r\n\n";
|
||||||
//String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n";
|
//String code = "foo;baar\r\n\r\nhello;\r\n\r\nworld;\r\n";
|
||||||
final CSVParser parser = CSVParser.parseString(code);
|
final CSVParser parser = CSVParser.parseString(code, CSVFormat.DEFAULT);
|
||||||
final List<CSVRecord> records = parser.getRecords();
|
final List<CSVRecord> records = parser.getRecords();
|
||||||
assertEquals(3, records.size());
|
assertEquals(3, records.size());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue