Code covered by the BSD License
function answer = strend (str1, str2) if iscell(str1) | iscell(str2) error('strend:cellInput', 'Cell arrays not supported.'); end if length(str1) > length(str2) answer = false; return; end answer = strcmp(str1, str2(end-length(str1)+1:end)); %answer = strmatch(fliplr(str1), fliplr(str2)); %if isempty(answer), answer = false; end end %!test %! myassert(strend('private', 'haha/private')); %! myassert(~strend('private', 'haha/private2')); %! myassert(~strend('packed:rcond:complexNotSupported', ... %! 'packed:chol:complexNotSupported'));
Contact us