Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java tokenizer, separating strings

 
Brad Traylor
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic