Results 1 to 3 of 3
- 12-02-2008, 11:09 PM #1
[SOLVED] Questions about StringTokenizer
So I'm looking at this StringTokenizer and I understand how it works when you just put in a String. It gives you what's between the white space. But there's something else you can do with it. You can use delimiters which is where I'm a little confused on how to create this tokenizer. What I want to do is get the tokens from a String such as:
And I want to be able to print each token out like this...Java Code:String s = "It's a nice day, don't you think?";
It s a nice day don t you think
So basically the tokenizer not only skips the white space, it skips punctuation marks as well, which you send in to the tokenizer. How can I do that?
Btw, I can't put the link to the java doc of StringTokenizer on here yet, don't have enough posts lol silly...
Thanksmiss.meli (-.-)zzZZ
- 12-02-2008, 11:19 PM #2
Here's what I have:
But there's a problem now. I solved the problem of the tokenizer skipping over the punctuation and numbers I want, but now it no longer skips over white space. I tried putting a space in there, but if there are several spaces like "this is cool" then it will token like this this is cool which I don't want, I want it to skip all whitespace...How can I fix this?Java Code:StringTokenizer st = new StringTokenizer(v, ".,?!:-1234567890");
miss.meli (-.-)zzZZ
- 12-03-2008, 08:26 AM #3
Similar Threads
-
StringTokenizer in a Palindrome program
By jeremyk in forum New To JavaReplies: 10Last Post: 02-13-2010, 06:35 PM -
StringTokenizer
By carderne in forum New To JavaReplies: 1Last Post: 01-26-2008, 08:19 PM -
StringTokenizer
By Java Tip in forum Java TipReplies: 0Last Post: 11-08-2007, 08:48 AM -
StringTokenizer
By Java Tip in forum Java TipReplies: 0Last Post: 11-03-2007, 09:24 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks