Cody

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

Solution 214482

Submitted on 8 Mar 2013 by Chintan
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% s = '508-647-7000, (508) 647-7001, 617-555-1212, 1-800-323-1234, 704 555-1212'; a = {'508','617','704','800'}; assert(isequal(refcn(s),a))

start_idx = ',' ',' ',' ',' end_idx = 13 29 43 59 extents = 13 29 43 59 matches = [] [] [] [] tokens = {1x0 cell} {1x0 cell} {1x0 cell} {1x0 cell} names = 1x4 struct array with no fields. splits = '508-647-7000' ' (508) 647-7001' ' 617-555-1212' ' 1-800-323-1234' ' 704 555-1212' m = 508 st = 1 e = 3 m = 508 st = 3 e = 5 m = 617 st = 2 e = 4 m = 800 st = 4 e = 6 m = 704 st = 2 e = 4

2   Pass
%% s = '212-657-0260; (888) 647-7001; 336 565-1212; +1-800-323-1234'; a = {'212','336','800','888'}; assert(isequal(refcn(s),a))

start_idx = ';' ';' ';' end_idx = 13 29 43 extents = 13 29 43 matches = [] [] [] tokens = {1x0 cell} {1x0 cell} {1x0 cell} names = 1x3 struct array with no fields. splits = '212-657-0260' ' (888) 647-7001' ' 336 565-1212' ' +1-800-323-1234' m = 212 st = 1 e = 3 m = 888 st = 3 e = 5 m = 336 st = 2 e = 4 m = 800 st = 5 e = 7