StringParser String tokenizer and parser

| Sunday, December 27, 2009
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 List getListToken() {
     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;
 }
}

0 comments:

Post a Comment