The moose likes Java in General and the fly likes Java tokenizer, separating strings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java tokenizer, separating strings" Watch "Java tokenizer, separating strings" New topic

Java tokenizer, separating strings

Brad Traylor

Joined: Oct 25, 2012
Posts: 1
I don't know why I am struggling so bad with this but any help would be much appreciated.

I am creating my own tokenizer that takes in a file with a list of commands, delimiters and values. It then outputs each "token" along with what type it is.

INPUT: AND 3, 4, 5 ; some comments
I need to output:
AND --- command
3 --- value
, --- delimiter
4 --- value
, --- delimiter
5 --- value

I have it working right now to where I am outputting:
AND 3, 4, 5 --- delimiter
but I need to break it down further.

Here is where I am at currently:

Only real constraints I have with this assignment is not being able to use StringTokenizer and regex.

Any help???
Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

Hi, and welcome to the Ranch!

Folks here will be better able to help you if you TellTheDetails(←click) of exactly what problems you're having. An SSCCE(←click) is also very helpful.

Since you say you can't use regex, that suggests this is a homework assignment. It will also help if you include any other constraints, restrictions, or requirements, so that we don't go around in circles offering suggestions only to have you come back and say, "I can't do that because..."

Happy coding!
I agree. Here's the link:
subject: Java tokenizer, separating strings
It's not a secret anymore!