相关代码 |
|
import java.util.StringTokenizer; public class CsvParser { private String[] currentLine; public void parse(String inputLine) { StringTokenizer tokenizer = new StringTokenizer(inputLine); currentLine = new String[tokenizer.countTokens()]; for (int i = 0; i < currentLine.length; i++) { currentLine[i] = tokenizer.nextToken(); } } public String get(int columnIndex) { return currentLine[columnIndex]; } }
相关资源 |
|