lundi 27 novembre 2017

Raptor Flowchart string proper phone number format

This is the problem i am trying to solve. I have found the way to pull out all the numbers and only print 10 digits. I am stuck on formatting within Raptor to the (817)555-1234 format.

Many websites ask for phone numbers. The problem is that there are many different ways to represent a phone number. Examples include 817-555-1234, 817 555 1234 (c), and (817) 555-1234 x23. Write a Raptor program which inputs a string containing a phone number in any format and outputs it in the standard format. For this assignment, the standard format is (817) 555-1234. Your Raptor program should:

  1. Input a string including the number
  2. Copy only the digits from the input string into another string
  3. Issue an error message if the input string does not contain at least 10 digits
  4. If the input string contains more than 10 digits, include only the first 10 digits in the formatted number
  5. Output the phone number in standard format

Aucun commentaire:

Enregistrer un commentaire