Cody

# Problem 42810. String Find with Wildcards of a Cell array

Solution 878462

Submitted on 20 Apr 2016 by LY Cao
• Size: 22
• This is the leading solution.
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
c={'abcdef' '12345' 'matfile.mat' 'fname.xls'}; str='*.xls'; assert(isequal(stridx(c,str),[4]))

idx = 4

2   Pass
c={'abcdef' '12345' 'matfile.mat' 'fname.xls'}; str='xls'; assert(isequal(stridx(c,str),[4]))

idx = 4

3   Pass
c={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'}; str='a*f'; assert(isequal(stridx(c,str),[1 3 4]))

idx = 1 3 4

4   Pass
c={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'}; str='a?f'; assert(isequal(stridx(c,str),[3]))

idx = 3

5   Pass
c={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'}; str='1*5'; assert(isequal(stridx(c,str),[2]))

idx = 2

6   Pass
c={'random' 'test.mart' 'rat' 'matfile.mat' 'random.mat' 'matfile'}; str='.ma*t'; assert(isequal(stridx(c,str),[2 4 5]))

idx = 2 4 5

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!