Pos ('content favor', 'content favor favorKey2') return 0
There is something not quite right here. If Elem is an object the content of the Classname property in your screenshot is not valid. A classname has to b a valid Delphi identifier, it cannot contain spaces.
Elem is IHTMLElementHis classname contain value of HTML tag "class"HTML tag "class" can contain spaces...
i:= Pos('content favor', LowerCase('content favor favorKey2'));
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
The output is 1, as expected. Your problem may be related to using a function as a watch expression.
I also tried to test in the "hello word" project and pos() work fine
But in real project not
if Pos('content favor', LowerCase(Elem.ClassName))=1 then
if copy(LowerCase(Elem.ClassName),1,Length('content favor'))='content favor' then
Now works fine...
I would suspect the strings you use then, perhaps what looks like a space is in fact a tab or some Unicode whitespace character.
In this case, why
"if copy(LowerCase(Elem.ClassName),1,Length('content favor'))='content favor' then"
try analise how "the function" is builded using CTRL+MOUSE and see the "secret".
many functions/procedures call many others, and with new add to Unicode and old ANSI standards some things was changed but the use stay almost the same.
See new functions to manipulate/converter text and compare what you should to use in fact.
Pos() in RIO