import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; public class StringParser { private String data; private String delimiter; public StringParser() { } public StringParser(String data, String delimiter) { this.data = data; this.delimiter = delimiter; } public ListgetListToken() { List tokens = new ArrayList (); StringTokenizer tokenizer = new StringTokenizer(data, delimiter); while (tokenizer.hasMoreTokens()) { tokens.add(tokenizer.nextToken()); } return tokens; } public String getData() { return data; } public void setData(String data) { this.data = data; } public String getDelimiter() { return delimiter; } public void setDelimiter(String delimiter) { this.delimiter = delimiter; } }
StringParser String tokenizer and parser
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment