Hi, I started making a program and now I have problem... Quite obvious...
Well, I wonder if you can make every token using StringTokenizer to a new string.
If someone could help quick it would be nice.
Thanks
//Hjorth96
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
Hi, I started making a program and now I have problem... Quite obvious...
Well, I wonder if you can make every token using StringTokenizer to a new string.
If someone could help quick it would be nice.
Thanks
//Hjorth96
Use String.spilt instead.
Will that split the whole sentence in the first string up in words? I want to make every word from that to a new string.
If the words are separated by spaces and you split around spaces you'll get an array of words.
E.g. if we have:
String example = "This is an example string. What do you think?"; String[] tokens = example.split(" ");
Then tokens will be an array of strings
["This","is","an","example","string.","What","do"," you","think?"]
You could further clean it up to remove non-alphabetical characters and change the case.