📄 ext56chk.m
字号:
% ext56chk.m makes sure that the string are looking for is not longer than the
% entire string being searched, returns 0 for "good_string" if not good or 1 if good
% 10-13-00
% findstr returns the starting indices of ANY occurrences of the SHORTER of the two strings
% in the LONGER and we want to be sure that it is ALWAYS finding the "check_string" within
% the "whole_string"
% FINDSTR Find one string within another.
% K = FINDSTR(S1,S2) returns the starting indices of any occurrences
% of the shorter of the two strings in the longer.
%
% Examples
% s = 'How much wood would a woodchuck chuck?';
% findstr(s,'a') returns 21
% findstr(s,'wood') returns [10 23]
% findstr(s,'Wood') returns []
% findstr(s,' ') returns [4 9 14 20 22 32]
function good_string = eig_good_string_check(whole_string, check_string)
% returns 0 for value of the function if the length of the whole_string is less
% than the check_string
if length(whole_string) < length(check_string)
good_string = 0;
return
end
% else returns 1 for value of the function if the length of the whole_string is not
% less than the check_string using Matlab findstr function below
good_string = ~isempty( findstr(whole_string, check_string) );
return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -