Find a substring

  • 24
  • Locked
The getPartOfString method must return the substring that begins with the character after the first space and ends with the end of the word that follows the 4th space. Example: "CodeGym is the best place to learn Java." Result: "is the best place" Example: "Amigo and Diego are best friends!"
You can't complete this task, because you're not signed in.
Comments (2)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Level 26 , Spanish Town, Jamaica
2 March, 18:40
This task does not want a "word" that follows the 4th whitespace, it wants the substring that follows it. or more generally, any character(s) that is not a whitespace. "hello my name is ^&*%#" returning "my name is ^&*%#" will pass. I wasted a lot of time on this because the two approaches I came up with (one using regex the other a for loop) would have thrown it an exception if the character after the 4th space was not a word character.
Level 34 , Phnom Penh, Cambogia
18 April 2020, 03:52
don't use "\\W'' can pass only (" ").