function s = eraseBetween(str, start, stop, varargin)
%MATLAB Code Generation Library Function
%
% Limitations:
%
%   1. str must be one of: string scalar, character row vector, scalar cellstr
%   2. start and stop must be numeric or one of: string scalar, character row
%   vector, scalar cellstr

%   Copyright 2017 The MathWorks, Inc.
%#codegen

narginchk(3, Inf);
if ~isstring(str) && ~ischar(str) && coder.internal.isAmbiguousTypes
    s = coder.ignoreConst(str);
    return
end
coder.internal.assert(isTextStrict(str), 'Coder:toolbox:MustBeCharOrString', 1);

st = string(str);
serased = st.eraseBetween(start, stop, varargin{:});

if ischar(str)
    s = char(serased);
elseif iscell(str)
    s = cellstr(serased);
else
    s = serased;
end
