It is so important to know that Tokenizer exists and to know what tools you have available to make your code powerful!
Try to solve this challenge before seeing the answer below.
Answer: This is an easy one. We created the object Scanner passing the String to be tokenized, separated by a pattern. At first, you’ve got to know what the symbols on the tokens mean.
This symbol is called Regex. Many languages use the same concept:
http://www.vogella.com/tutorials/JavaRegularExpressions/article.html
In simple words, this symbol “^\\w” means “not a word” and the “*” means that – Occurs zero or more times, is short for {0,}, so it will tokenize by the comma “,“.
The result is:
ThisIsIt
theFinalString
NoBugsProject
The regex [^\\w*] does not mean “not a word”, it means “not a word and not a *”.
Hi DOLAN, thanks for your comment. Actually the “*” means that – Occurs zero or more times, is short for {0,}