AnsiStrIComp does not compare strings in Delphi 2010

I am a little confused and hope for enlightenment.

I am using Delphi 2010 for this project and I am trying to compare 2 lines.

Using the code below

if AnsiStrIComp(PAnsiChar(sCatName), PAnsiChar(CatNode.CatName)) = 0 then...

because according to the debugger, only the first character of each line is compared (i.e. if sCatName- "Automobiles", PAnsiChar(sCatName)- "A").

I want to be able to compare strings that can be in different languages, for example, English and Japanese.

In this case, I am looking for a match, but I have other functions used for sorting, etc., where I need to know how to compare strings (less, equal, more).

+3
source share
2 answers

, sCatName CatNode.CatName string (= UnicodeString s)?. .

! ( ) Windows API.

, SameStr(S1, S2) ( ) SameText(S1, S2) ( ) S1 = S2 . true false, .

( ), CompareStr(S1, S2) CompareText(S1, S2). , .

( Ansi-: AnsiSameStr, AnsiSameText, AnsiCompareStr AnsiCompareText; . non Ansi- , , .)

Update

Remy Lebeau .

+5

sCatName=CatNode.CatName? strings, .

0

Source: https://habr.com/ru/post/1755119/


All Articles