954,536 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

stream tokenizer

Can anyone give me a basic script that takes a string and converts it into a characters using the nexttoken command to get the next char for searching purposes.

jordanmc31
Newbie Poster
3 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

Try using a while loop and character array. Also look up StringTokenizer in the API: http://java.sun.com/j2se/1.4.2/docs/api/

You should be able to work it out from there. :)

MrScruff
Junior Poster in Training
89 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

I used the buffered reader to get the line. Then a string tokenizer to get it into seperate words. I have no idea on getting the words broken into chars

jordanmc31
Newbie Poster
3 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

Ok look up String in the API - there are two methods which you can use in there.

and heres a tutorial on conversion:
http://mindprod.com/jgloss/conversion.html

Hope that helps :)

MrScruff
Junior Poster in Training
89 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

Alright I got it into an array... Now I can't get through the array. I'm using a for loop to search character by character. At the end of the first character array i get an exception error and cant get past that part. Any other ideas for a way to get through the character array.

jordanmc31
Newbie Poster
3 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

Thats the best way to get through an array - is the exception error a arrayoutofbounds one? Check your i

MrScruff
Junior Poster in Training
89 posts since Nov 2004
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You