Java Challenge #9: Tokenizer

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:

In simple words, this symbol “[^\\w*]” means “not a word” so it will tokenize by the comma “,“.

The result is:

Java Challenge #9: Tokenizer

One thought on “Java Challenge #9: Tokenizer

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s