function b = hasIRIPrefix(path)

%MATLAB Code Generation Private Function

% Check if path has IRI prefix
%   Copyright 2023 The MathWorks, Inc.
%#codegen

pthSz = coder.internal.indexInt(numel(path));
if iscell(path)
    b = coder.nullcopy(zeros(1,numel(path),'logical'));
    for i = 1:pthSz
        b(i) = hasIRIPrefix(path{i});
    end
    return;
end

colon = ':';
slash = '/';
period = '.';
hyphen = '-';
plus = '+';

if pthSz < 4
    b = false;
    return;
end

if ~isletter(path(1))
    b = false;
    return;
end

pred = @(c) isstrprop(c, 'alphanum') || c == period || c == hyphen || c == plus;
if ~pred(path(2))
    b = false;
    return;
end

colIdx = coder.internal.indexInt(0);
for i = 3:pthSz
    if ~pred(path(i))
        if path(i) ~= colon
            b = false;
            return;
        else
            colIdx = i;
            break;
        end
    end
end

if colIdx == 0
    b = false;
    return;
end

% at least two chars after colon
if colIdx+1 >= pthSz
    b = false;
    return;
end

if path(colIdx+1) == slash
    b = true;
    return;
end
b = hasIRIPrefix(path(colIdx+1:end));

end