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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!