Problem 91. Get the area codes from a list of phone numbers

Created by Cody Team in Community

Given a string of text with phone numbers in it, return a unique'd cell array of strings that are the area codes.

 s = '508-647-7000, (508) 647-7001, 617-555-1212'; 


 a = {'508','617'}

Note: This problem refers to American-style phone numbers. You can assume the first three digits of a ten-digit number will always be the area code.

Solution Stats

42.36% Correct | 57.64% Incorrect
Last solution submitted on Feb 13, 2019

Problem Comments

Solution Comments

Recent Solvers371

Suggested Problems

More from this Author95


Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!