📄 str_in_url.m
字号:
%STR_IN_URL: This function searches for a string in a html page.
%
% Syntax>>
% code_name=str_in_url(url_content2,str_find,limiting_str)
%
% url_content2 is the content of the html page which is read by using
% urlread function.
% str_find is the string which is searched in the html page, i.e. in
% url_content2 and the string which is actually to be searched exists
% next to this string and that is code_name.
% limiting_str is the character which is just next to code_name.
% For example, >>>
% "<img% src=http://www.mathworks.com/matlabcentral/files/authors/1093599.jpg alt="">"
% image_file=str_in_url(url_content2,'<img src=http://www.mathworks.com/matlabcentral/files/authors/',' ');
% results in image_file='1093599.jpg'.
% Another example >>>
% "Rank: 7<br>"
% rank=cellstr(str_in_url(url_content2,'Rank: ','<'));
% results in rank='7'.
% Classes of "url_content2","str_find" and "limiting_str" are char arrays
% Class of "code_name" is char array too.
function code_name=str_in_url(url_content2,str_find,limiting_str)
code_start=findstr(url_content2,str_find)+length(str_find);
code_name='';
empty_code_start=isempty(code_start);
if empty_code_start~=1
for i=0:200
if url_content2(code_start(1)+i)~=limiting_str
code_name=[code_name url_content2(code_start(1)+i)];
else
break,end
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -