Question: Write a function below called reformatNumber that takes String containing a phone number in this format 111-222-3333 and returns a String in the following format:
Write a function below called reformatNumber that takes String containing a phone number in this format 111-222-3333 and returns a String in the following format: (111) 222-3333.
You should explore one or both of the following String methods to help you
split: splits the string into parts based on a given character
substring: returns a portion of the String from a start position to an end position.
in java please
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
