Skip to content

Commit a98f2f5

Browse files
committed
improve substring indexing
1 parent ee77934 commit a98f2f5

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

+stdlib/expanduser.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
if ischar(e)
3131
e = strcat(home, '/', e(3:end));
3232
else
33-
e = home + "/" + extractAfter(e, 2);
33+
e = home + "/" + e{1}(3:end);
3434
end
3535

3636
end

+stdlib/is_absolute.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
if ischar(p)
2323
s = p(3); %#ok<UNRCH>
2424
else
25-
s = extractBetween(p, 3, 3);
25+
s = p{1}(3);
2626
end
2727
y = strlength(stdlib.root_name(p)) && (strcmp(s, '/') || strcmp(s, '\'));
2828
else

+stdlib/normalize.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
if isempty(j)
4444
n = "";
4545
else
46-
n = extractBefore(n, j(end));
46+
n = n{1}(1:j(end)-1);
4747
end
4848
end
4949
elseif all(parts(i) ~= [".", ""])

+stdlib/parent.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
elseif ischar(p)
3535
p = p(1:j(end)-1);
3636
else
37-
p = extractBefore(p, j(end));
37+
p = p{1}(1:j(end)-1);
3838
end
3939

4040
if is_root_stub(p)

+stdlib/private/h5save_scalar.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ function h5save_scalar(file, hpath, A)
4444
case 'double', t = 'H5T_NATIVE_DOUBLE';
4545
case 'single', t = 'H5T_NATIVE_FLOAT';
4646
case {'int8', 'int16', 'int32', 'int64'}
47-
t = "H5T_STD_I" + extractBetween(C, 4, strlength(C)) + "LE";
47+
t = "H5T_STD_I" + C(4:end) + "LE";
4848
case {'uint8', 'uint16', 'uint32', 'uint64'}
49-
t = "H5T_STD_U" + extractBetween(C, 5, strlength(C)) + "LE";
49+
t = "H5T_STD_U" + C(5:end) + "LE";
5050
otherwise, error('h5save:class2h5t: unknown data class %s', class(A))
5151
end
5252

+stdlib/root_name.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
r = p(1:2);
2020
end
2121
else
22-
if extractBetween(p, 2, 2) == ":" && isletter(extractBetween(p, 1, 1))
23-
r = extractBetween(p, 1, 2);
22+
if p{1}(2) == ":" && isletter(p{1}(1))
23+
r = p{1}(1:2);
2424
end
2525
end
2626

private/publish_gen_index_html.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function publish_gen_index_html(pkg_name, tagline, project_url, outdir)
2424

2525
%% Git info
2626
repo = gitrepo(pkg.path);
27-
git_txt = "Git branch / commit: " + repo.CurrentBranch.Name + " " + extractBefore(repo.LastCommit.ID, 8);
27+
git_txt = "Git branch / commit: " + repo.CurrentBranch.Name + " " + repo.LastCommit.ID{1}(1:8);
2828

2929
%% generate docs
3030
readme = fullfile(outdir, "index.html");

0 commit comments

Comments
 (0)