stream tokenizer

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2004
Posts: 3
Reputation: jordanmc31 is an unknown quantity at this point 
Solved Threads: 0
jordanmc31 jordanmc31 is offline Offline
Newbie Poster

stream tokenizer

 
0
  #1
Nov 20th, 2004
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 89
Reputation: MrScruff is an unknown quantity at this point 
Solved Threads: 0
MrScruff's Avatar
MrScruff MrScruff is offline Offline
Junior Poster in Training

Re: stream tokenizer

 
0
  #2
Nov 20th, 2004
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 3
Reputation: jordanmc31 is an unknown quantity at this point 
Solved Threads: 0
jordanmc31 jordanmc31 is offline Offline
Newbie Poster

Re: stream tokenizer

 
0
  #3
Nov 20th, 2004
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 89
Reputation: MrScruff is an unknown quantity at this point 
Solved Threads: 0
MrScruff's Avatar
MrScruff MrScruff is offline Offline
Junior Poster in Training

Re: stream tokenizer

 
0
  #4
Nov 21st, 2004
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 3
Reputation: jordanmc31 is an unknown quantity at this point 
Solved Threads: 0
jordanmc31 jordanmc31 is offline Offline
Newbie Poster

Re: stream tokenizer

 
0
  #5
Nov 21st, 2004
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 89
Reputation: MrScruff is an unknown quantity at this point 
Solved Threads: 0
MrScruff's Avatar
MrScruff MrScruff is offline Offline
Junior Poster in Training

Re: stream tokenizer

 
0
  #6
Nov 21st, 2004
Thats the best way to get through an array - is the exception error a arrayoutofbounds one? Check your i<whatever bit in the forloop - it may trying to check out more spaces in the array than there actually are.

Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum


Views: 3920 | Replies: 5
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC