CodeGym /Courses /Java Multithreading /Practice using StringTokenizer and String.replace

Practice using StringTokenizer and String.replace

Java Multithreading
Level 2 , Lesson 13
Available
Practice using StringTokenizer and String.replace - 1

"Not so fast. Do a couple of tasks, and then you'll have mastered it."

12
Task
Java Multithreading, level 2, lesson 13
Locked
StringTokenizer
StringTokenizer
12
Task
Java Multithreading, level 2, lesson 13
Locked
Changing the encoding
Changing the encoding
24
Task
Java Multithreading, level 2, lesson 13
Locked
Phone number verification
Phone number verification
Comments (9)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
matemate123 Level 50, Kraków, Poland
22 March 2023
Can be helpful: https://codegym.cc/groups/posts/regex-java
阿狼 Level 32, Zhengzhou, China
8 July 2022
d30
Jomar Tayactac Level 5, Winnipeg, Canada Expert
28 June 2022
For phone number verification, don't forget to check if the phone number is null or empty.
18 December 2021
针对开头匹配数字长度 phoneNumber.matches("^+.*") && phoneNumber.replaceAll("\\D","").toCharArray().length!=12
aijo Level 30, Germany, Germany
29 April 2022
funnily, I used regex in the second part, but not the first (exactly opposite to you):

if (phoneNumber.startsWith("+")) return phoneNumber.replaceAll("[\\D]","").matches("[\\d]{12}");
Adam Level 25, London, United Kingdom
20 October 2020
Regex is awesome but makes my brain ache still :)
Lawson Level 29, Lagos, Nigeria
13 September 2020
The task are getting deadlier by the day
MaGaby2280 Level 41, Guatemala City, Guatemala
30 June 2020
Really hard ones... try to think the easiest and simplest way possible!
Hossein Shams Level 1, Atlanta, United States
3 November 2019
Love RegEx