chompsep.m
来自「Multicore - Parallel Processing on Multi」· M 代码 · 共 21 行
M
21 行
function str = chompsep(str)
%CHOMPSEP Remove file separator at end of string.
% STR = CHOMPSEP(STR) returns the string STR with the file separator at
% the end of the string removed (if existing). Further, all file
% separators are replaced by "/".
%
% Example:
% str1 = chompseq('/usr/local/');
% str2 = chompseq('C:\Program Files\');
%
% Markus Buehren
% Last modified 03.02.2008
%
% See also CONCATPATH.
str = strrep(str, '\', '/');
if ~isempty(str) && str(end) == '/'
str(end) = '';
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?