We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eadb0b6 commit 35b459eCopy full SHA for 35b459e
+stdlib/filename.m
@@ -7,19 +7,17 @@
7
8
function f = filename(p, method)
9
arguments
10
- p
11
- method = 'pattern'
+ p string
+ method {mustBeMember(method, {'pattern', 'regexp'})} = 'pattern'
12
end
13
14
% the pattern method is a few percent faster than regexp
15
switch method
16
- case 'pattern', f = extractAfter(p, asManyOfPattern(wildcardPattern + ("/" | filesep)));
+ case 'pattern'
17
+ f = extractAfter(p, asManyOfPattern(wildcardPattern + ("/" | filesep)));
18
case 'regexp'
19
f = regexp(p, ['[^/\' filesep ']*$'], 'match', 'once');
- try %#ok<TRYNC>
20
- f(ismissing(f)) = "";
21
- end
22
- otherwise, error('unknown method %s', method)
+ f(ismissing(f)) = "";
23
24
25
0 commit comments