Skip to content

Commit a243ffa

Browse files
committed
drop_slash: correct/simplify based on new tests
1 parent dc86bc1 commit a243ffa

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

+stdlib/drop_slash.m

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,13 @@
1010

1111
s = stdlib.posix(p);
1212

13-
uncslash = ispc() && startsWith(s, '//');
14-
1513
% drop repeated slashes inside string
1614
d = regexprep(s, '/+', '/');
1715

18-
L = strlength(d);
19-
20-
if L < 2
21-
if uncslash
22-
d = '//';
23-
end
24-
elseif ~ispc() || (L ~= 3 || ~strcmp(d, stdlib.root(s)))
16+
if ~ispc() || ~strcmp(d, stdlib.root(s))
2517
d = regexprep(d, '/$', '');
2618
end
2719

28-
if uncslash
29-
d = strcat('/', d);
30-
end
31-
3220
if isstring(p)
3321
d = string(d);
3422
end

0 commit comments

Comments
 (0)