StringTokenizer

  • 12
  • Locked
Using a StringTokenizer, split the query into parts using the String delimiter. For example, getTokens("level22.lesson13.task01", ".") returns a string array {"level22", "lesson13", "task01"}
You can't complete this task, because you're not signed in.
Comments (1)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Justin Smith
Level 38 , Greenfield, USA, United States
16 December 2021, 12:19
Not sure why this is rated Medium, it was actually quite easy. It's a very straightforward use of StringTokenizer (although it's worth pointing out that String.split() is more suited for this specific example). But it's a good reminder that even if the task is easy, it's worth checking the solution afterwards to see a more compact way of solving the problem. I had ended up creating an intermediate ArrayList which I now see to be unnecessary.