org.tbee.csv
Class CSVStringParser
java.lang.Object
org.tbee.csv.CSVStringParser
public class CSVStringParser
- extends Object
This class can split up a string based on CSV logic.
It is used by FileParser to split up the individual lines.
Usage is simple:
// create the parser
CSVStringParser lCSVStringParser = new CSVStringParser();
// parse a string
lFields = lCSVStringParser.parse("test,test,test");
The field separator is per default a comma (,) but can be set prior to parsing.
The parser recognizes empty fields (",,,") and returns an empty string.
The separator can be escaped using the escaper (default escaper is '\', so '\,') and the escaper can be escaped also ('\\')
- Version:
- $Revision: 1.8 $
- Author:
- $Author: cvs $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SOURCECODE_VERSION
public static final String SOURCECODE_VERSION
- Standard variable for determining version of a class file.
- See Also:
- Constant Field Values
CSVStringParser
public CSVStringParser()
setSeparator
public void setSeparator(char pSeparator)
getSeparator
public char getSeparator()
setEscaper
public void setEscaper(char pEscaper)
getEscaper
public char getEscaper()
setQuote
public void setQuote(char pQuote)
getQuote
public char getQuote()
parse
public String[] parse(String pCSVString)
- Parse the string and return the fields
Copyright © 2011 KnowledgePlaza. All Rights Reserved.