class StringToken
...{
//數據
private string data;
//分隔符
private string delimiter;
private string[] tokens;
private int index;
public StringToken(string dataline)
...{
init(dataline, " ");
}
private void init(string dataline, string deli)
...{
delimiter = deli;
data = dataline;
tokens = data.Split(deli.ToCharArray());
index = 0;
}
public StringToken(string&
nbsp;dataline, string deli)
...{
init(dataline, deli);
}
public bool HasMoreElements()
...{
return index < tokens.Length;
}
public string GetNextElement()
...{
if (index > tokens.Length)
...{
return tokens[index++];
}
else
>
...{
return "";
}
}
}