pisabsolutepath.m

来自「利用Stateflow 进行嵌入式代码开发很好用」· M 代码 · 共 25 行

M
25
字号
function bool = pIsAbsolutePath(thisPath)
%PISABSOLUTEPATH Returns true if the path is absolute.
%

%   Copyright 2005 The MathWorks, Inc.
%   $File: $
%   $Revision: $
%   $Date:  $

bool = 1;

if isempty(thisPath)
    return
end

if(thisPath(1)=='.')
    bool = 0;
else
    if(ispc && length(thisPath)>=2)
        bool = (thisPath(2)==':') | (thisPath(1)=='\');
    else
        bool = thisPath(1)=='/';
    end
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?