troubleshooting Question

Having problem with stringtokenizer and seperating strings on a line

Avatar of tyweed420
tyweed420 asked on
10 Comments1 Solution208 ViewsLast Modified:
I have this text file

"CS157" "Databases" "3" "CS"
"Cs151" "OOP" "4" "CS"
"Anthro147" "Human Sexuality" "6" "Ap" <=========  see that human sexuality. i need that to break down to one word but its making it two words. How would i make it so within quotes is one word?

you can see belowq i'm delimiting tabs and quotes so its taking human sexuality as two words. I'd like if its even three words but within quotes it be stored as a single string.

But not sure how i'd do this can it be done with stringtokenizer or is there a better tool fore this?

 while(line != null)
       StringTokenizer tokens = new StringTokenizer(line," \" \t");
       list = new ArrayList();

       while (tokens.hasMoreTokens())
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros