Cody

# Problem 362. Find matching string from a list of strings

Solution 1259683

Submitted on 30 Aug 2017 by Informaton
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
inStr = 'ball'; strList = {'ball', 'bell', 'barn'}; assert(isequal(findMatch(inStr, strList), 'ball'));

ans = 1 ans = 'ball'

2   Pass
inStr = 'auG'; strList = {'May', 'June', 'July', 'August', 'September'}; assert(isequal(findMatch(inStr, strList), 'August'));

ans = 1×0 empty double row vector ans = 'August'

3   Pass
inStr = 'Ju'; strList = {'May', 'June', 'July', 'August', 'September'}; assert(isequal(findMatch(inStr, strList), ''));

ans = 1×0 empty double row vector ans = 0×0 empty char array

4   Pass
inStr = 'fontn'; strList = {'FontName', 'FontUnits', 'FontSize', 'FontWeight'}; assert(isequal(findMatch(inStr, strList), 'FontName'));

ans = 1×0 empty double row vector ans = 'FontName'

5   Pass
inStr = 'weight'; strList = {'FontName', 'FontUnits', 'FontSize', 'FontWeight'}; assert(isequal(findMatch(inStr, strList), 'FontWeight'));

ans = 1×0 empty double row vector ans = 'FontWeight'

6   Pass
inStr = 'ball'; strList = {'baseball', 'balloon', 'ball'}; assert(isequal(findMatch(inStr, strList), 'ball'));

ans = 3 ans = 'ball'

7   Pass
inStr = 'bal'; strList = {'baseball', 'balloon', 'ball'}; assert(isequal(findMatch(inStr, strList), ''));

ans = 1×0 empty double row vector ans = 0×0 empty char array