QuotedStringTokenizer implements ITokenizer { @Override public String[] tokenize(String input) { String[] result = tokenizeWithRegExp(input); if(trimValues) { result = StringUtils.trimAllElements(result); } return result; } QuotedStringTokenizer(String columnDelimiter, boolean trimValues); @Override String[] tokenize(String input); @Override String toString();  }
@Test public void testQuotedStringTokenizer_Trim() { String input = "\" Value0,Value1 \",Value2 "; String[] result = new QuotedStringTokenizer(",", true).tokenize(input); Assert.assertNotNull(result); Assert.assertEquals(2, result.length); Assert.assertEquals("Value0,Value1", result[0]); Assert.assertEquals("Value2", result[1]); }
@Test public void testQuotedStringTokenizer_Without_Trim() { String input = "\" Value0,Value1 \", Value2"; String[] result = new QuotedStringTokenizer(",", false).tokenize(input); Assert.assertNotNull(result); Assert.assertEquals(2, result.length); Assert.assertEquals(" Value0,Value1 ", result[0]); Assert.assertEquals(" Value2", result[1]); }