Skip to content

Commit c93bedd

Browse files
committed
deblank instead of strip for consistency
1 parent a3c842c commit c93bedd

15 files changed

+19
-22
lines changed

+stdlib/+sys/cpu_load.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
return
1616
end
1717

18-
L = str2double(strip(m));
18+
L = str2double(m);
1919

2020
if ispc()
2121
L = L / 100.;

+stdlib/+sys/create_symlink.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
cmd = sprintf('ln -s "%s" "%s"', target, link);
1111
end
1212

13-
if stdlib.exists(target) && strlength(link) && ~stdlib.exists(link)
13+
if stdlib.exists(target) && ~stdlib.strempty(link) && ~stdlib.exists(link)
1414
[stat, m] = system(cmd);
1515
ok = stat == 0;
1616
end

+stdlib/+sys/filesystem_type.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
function [t, cmd] = filesystem_type(file)
2-
arguments
3-
file (1,1) string
4-
end
52

63
t = '';
74

@@ -19,7 +16,7 @@
1916
if stdlib.exists(file)
2017
[s, t] = system(cmd);
2118
if s == 0
22-
t = strip(t);
19+
t = deblank(t);
2320
end
2421
end
2522

+stdlib/+sys/get_owner.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
if stdlib.exists(file)
1515
[s, m] = system(cmd);
1616
if s == 0
17-
o = strip(m);
17+
o = deblank(m);
1818
end
1919
end
2020

+stdlib/+sys/get_process_priority.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[s, m] = system(cmd);
1212
if s == 0
1313
if ispc()
14-
i = strip(m);
14+
i = deblank(m);
1515
else
1616
i = str2double(m);
1717
end

+stdlib/+sys/get_username.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
[s, n] = system(cmd);
99

1010
if s == 0
11-
n = strip(n);
11+
n = deblank(n);
1212
else
1313
n = '';
1414
end

+stdlib/+sys/hostname.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[s, n] = system(cmd);
55

66
if s == 0
7-
n = strip(n);
7+
n = deblank(n);
88
else
99
n = '';
1010
end

+stdlib/+sys/inode.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
[s, m] = system(cmd);
1717
if s == 0
1818
if ispc()
19-
m = strrep(strip(m), "File ID is ", "");
19+
m = strrep(m, "File ID is ", "");
2020
% https://www.mathworks.com/help/releases/R2025a/matlab/ref/hex2dec.html
2121
i = sscanf(m, '%lx', 1);
2222
if i == intmax('uint64')

+stdlib/+sys/is_char_device.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
if ispc()
66
% https://learn.microsoft.com/en-us/windows/console/console-handles
77
charDevs = ["NUL", "CONIN$", "CONOUT$"];
8-
ok = contains(file, charDevs);
8+
ok = ismember(file, charDevs);
99
else
1010
cmd = sprintf('test -c %s', file);
1111

+stdlib/+sys/is_removable.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636

3737
elseif ismac()
3838

39-
cmd2 = sprintf('diskutil info "%s"', m1);
39+
cmd2 = sprintf('diskutil info "%s"', deblank(m1));
4040
[s2, m2] = system(cmd2);
4141
y = s2 == 0 && contains(m2, "Removable Media:" + whitespacePattern + "Removable");
4242

4343
else
4444

45-
dev = strip(extractAfter(m1, '/dev/'));
45+
dev = deblank(extractAfter(m1, '/dev/'));
4646
f1 = sprintf('/sys/class/block/%s/removable', dev);
4747
if isfile(f1)
48-
y = strip(fileread(f1)) == "1";
48+
y = startsWith(fileread(f1), '1');
4949
end
5050

5151
end

0 commit comments

Comments
 (0)