开发者

Why doesn't SameText work?

开发者 https://www.devze.com 2023-03-23 00:15 出处:网络
Why does if SameText(Lis开发者_Go百科tBox1.Items[i],Edit1.Text)=true then not work? It is case-sensitive (strings have different cases), but must be not. The strings are unicode. It works if the st

Why does

if SameText(Lis开发者_Go百科tBox1.Items[i],Edit1.Text)=true then

not work? It is case-sensitive (strings have different cases), but must be not. The strings are unicode. It works if the strings have the same cases.

Thanks!


According to SysUtils.pas (Delphi-XE), SameText "has the same 8-bit limitations as CompareText", and in CompareText "the compare operation is based on the 8-bit ordinal value of each character, after converting 'a'..'z' to 'A'..'Z', and is not affected by the current user locale."

So it seems that you are trying to compare some characters that are outside the 8 bit range.

Edit: you should try AnsiSameText.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号