简体   繁体   中英

Why doesn't SameText work?

Why does

if SameText(ListBox1.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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM