-
StringTokenizer
I have this code
st = new StringTokenizer(line, " \n\t\r\'\",;()-.");
while(st.hasMoreTokens())
{
try
{
temp= st.nextToken();;
word++;
System.out.println(temp);
if (temp.length() >= 7)
{
l_word++;
System.out.println("lang "+temp+ ":"+l_word);
}
are there any way to check if the delimiters are - to example .
and then count++ or have i to make a new loop
-
try:
st = new StringTokenizer(line, " \n\t\r\'\",;()-.", true);
Then your delimiters themselves will be returned as well as your delimited text.
cudabean