user1869767
user1869767

Reputation: 1

StringTokenizer extraction limit

I'm trying to extract file name in a text file. Currently, i'm using tokenizer. Somehow, not all of the file names is extracted correctly.

This is my code:

list = sc.nextLine();
token = new StringTokenizer(list,".txt");
newlist = token.nextToken();

This is what happen: The token only extract "Kesiha" insted of "Kesihatan"

Solutions?

Upvotes: 0

Views: 428

Answers (1)

harryr
harryr

Reputation: 126

From the doc for StringTokenizer

"All characters in the delim argument are the delimiters for separating tokens."

So Its splitting on the "t"

Upvotes: 1

Related Questions