CodeGym /Courses /Java Multithreading /Practice finding and retrieving substrings

Practice finding and retrieving substrings

Java Multithreading
Level 2 , Lesson 5
Available
Practice finding and retrieving substrings - 1

"Hi, Amigo!"

"You won't believe it. I just finished all the tasks for you!"

"Sweet! Thanks, Diego."

"But I'm not going to give them to you. So, you do them—it will make you smarter:"

24
Task
Java Multithreading, level 2, lesson 5
Locked
Threads of a string or stringy threads? That's the question
1. The getPartOfString method must return the substring between the first and the last tab characters. 2. The getPartOfString method should throw an exception if it receives invalid data: a) StringForFirstThreadTooShortException if the thread's name is FIRST_THREAD_NAME.
24
Task
Java Multithreading, level 2, lesson 5
Locked
Find a substring
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!"
6
Task
Java Multithreading, level 2, lesson 5
Locked
Between tabs
The getPartOfString method must return the substring between the first and the second tab characters. If the input data is invalid, throw a StringTooShortException. Don't change the StringTooShortException class.
Comments (14)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Evgeniia Shabaeva Level 40, Budapest, Hungary
6 December 2024
Cool, I've learned a lot about exceptions all of a sudden) Thank you!
Hubert Matlak Level 34, Poland, Poland
5 April 2023
Cool tasks, don't understand such a low rate of the second one. Doeble and not too hard
阿狼 Level 32, Zhengzhou, China
6 July 2022
d28
31 March 2021
Hmm, suddenly Threads after String methods, this is interesting
isaacfibo Level 24, Huntington, United Kingdom
10 October 2020
Am I the only one didn't get the joke?
Andrei Level 41
26 March 2021
She was leaving him just as he won the lottery.
31 March 2021
Just don't try to make any connections here, seems like Diego smokes something sometimes
Agent Smith Level 38
28 September 2020
Threads of a string or string threads? That's the question Very good exercise! A nice mix of old material for repetition + some new tricks.
Henrique Level 41, São Paulo, Brazil
20 July 2020
Hint for the first one ("Find a substring"): I used split and replaceFirst methods.
Sanjay Chauhan Level 28, Delhi, India
2 April 2020
for "Find a substring", use split method to pass the task.
JianQiu Hwang Level 35, Washington
6 June 2020
Just use a while-loop with string.indexof().
MaGaby2280 Level 41, Guatemala City, Guatemala
25 June 2020
how did you achieve that? I have tried, but have not succeded
Tian Pro Level 23, Cape Town, South Africa
16 March 2020
Couldn't manage any of these >.< this definitely getting hard!
Vahan Level 41, Tbilisi, Georgia
19 December 2019
If luck comes, then in everything))