id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

norm.krumpe@muohio.edu > formatPhone
prev  |  next  |  chance

Given a string representing a 10-digit phone number of the form "5135290351", return a formatted phone number with parentheses and a hyphen, like this: "(513)529-0351".


formatPhone("5135290351") → "(513)529-0351"
formatPhone("1234567890") → "(123)456-7890"
formatPhone("9999999999") → "(999)999-9999"

...Save, Compile, Run (ctrl-enter)

String formatPhone(String str) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 100

Copyright Nick Parlante 2017 - privacy