function tf = startsWith(str, pattern, varargin)
%MATLAB Code Generation Library Function
%
% Limitations:
%
%   1. str and pattern must be one of: string scalar, character row vector,
%   scalar cellstr

%   Copyright 2017 The MathWorks, Inc.
%#codegen

narginchk(2, inf);

if ~isstring(str) && ~ischar(str) && coder.internal.isAmbiguousTypes
    tf = coder.ignoreConst(false);
    return
end

coder.internal.assert(isTextStrict(str), 'Coder:toolbox:MustBeCharOrString', 1);

st = string(str);
tf = st.startsWith(pattern, varargin{:});
