Strfind doesn't find string
古いコメントを表示
Hi everyone
I'm web scrapping using strfind but I can't find one string with spaces. Assume that part of my text is the following:
tempHTML2=' Área <strongclass="search-results-property-list__feature-value"> 65.0'
And I want this:
str14='Área <strongclass="search-results-property-list__feature-value">';
However, strfind(tempHTML2,str14) returns me blank. If I remove 'Área ', it returns the correct location of the string. If I look for just ' Área', it also finds correctly.
One issue could be the blank spaces. However, the tempHTML2 is constructed as follows:
tempHTML2=tempHTML;
tempHTML2(tempHTML2==' ')=[];
One issue is that tempHTML2 has blank spaces even after deleting them. The sum(ismember(tempHTML2,' ')) returns zero.
Thanks in advance,
6 件のコメント
Steven Lord
2016 年 6 月 1 日
Can you show the full output of these two commands?
D1 = double(tempHTML2)
D2 = double(str14)
the cyclist
2016 年 6 月 1 日
For what it's worth, the code
tempHTML2=' Área <strongclass="search-results-property-list__feature-value"> 65.0';
str14='Área <strongclass="search-results-property-list__feature-value">';
strfind(tempHTML2,str14)
returns "2" for me.
Walter Roberson
2016 年 6 月 1 日
You remove blanks from your template but not from str14
hpramos4@gmail.com
2016 年 6 月 1 日
編集済み: hpramos4@gmail.com
2016 年 6 月 1 日
Walter Roberson
2016 年 6 月 1 日
Please attach a copy of the tempHTML2 (before blank removal), or post the URL.
hpramos4@gmail.com
2016 年 6 月 1 日
回答 (1 件)
カテゴリ
ヘルプ センター および File Exchange で Characters and Strings についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!