-
if StrComp_NoCase(#$CE#$D2, #$C4#$E3) = 0 then MsgOK('StrComp_NoCase Equal'); if StrLComp_NoCase(#$CE#$D2, #$C4#$E3, 2) = 0 then MsgOK('StrLComp_NoCase Equal');
i think Init_Upper() have bug, AnsiUpperCase will change to uppercase
procedure Init_Upper; var c: AnsiChar; s: AnsiString; begin if not Upper_initialized then begin for c := Low(c) to High(c) do begin s := c + AnsiChar( ' ' ); Upper[c] := AnsiUpperCase( s )[1]; end; Upper_initialized := TRUE; end; end;
-
In my case, MsgOK are not called. To check I added MsgOK before, it is called OK and shows different strings: program Project1;
uses
KOL;
begin
MsgOK( #$CE#$D2' '#$C4#$E3);
if StrComp_NoCase(#$CE#$D2, #$C4#$E3) = 0 then
MsgOK('StrComp_NoCase Equal');
if StrLComp_NoCase(#$CE#$D2, #$C4#$E3, 2) = 0 then
MsgOK('StrLComp_NoCase Equal');
end.
So what wrong?
-
my windows's language is chinese, msgok is called
-
#$CE#$D2 - is it a single character or two characters? Do you use UNICODE_STR ? It seems in that case only Unicode functions should be used. StrComp_NoCase etc is for 1-byte characters including ANSI only characters. For languages having not too more letters it is sufficient using it. For Asian character sets I very doubt that it is sufficient (except may by Japan Khatakhana or Birman alpabet, but I am not sure too).
-
i use TStrList.IndexOfName, My Name Is "#$CE#$D2", I Found IndexOfName(#$CE#$D2) is alwary return 0 if My first Name is Multi byte char. I read the source, found StrLComp_NoCase problem. it work good in KOL2.88,Kol 2.88's IndexOfName rename to IndexOfName_Old from kol 3.00, for compatible, the New IndexOfName Maybe rename to IndexOfName_NoCase, IndexOfName_Old will keep IndexOfName.my project have a lot of code use IndexOfName, I Must rename to IndexOfName_Old?
-
if StrComp_NoCase(#$EA, #$EB) = 0 then MsgOK('equal');
MsgOk will be called in chinese windows
-
IndexOfName_Old uses exact comparison without any convsersions, i.e. 'Abc' <> 'abc'. You can assume it as IndexOfName_CaseSensitive, but the name is already got. I suspect that in case of Chinese default language using ANSI case conversion can transform characters assuming it as hieroglyphs.
-
for compatible reseason, i strongly recommend rename new IndexOfName to IndexOfName_NoCase, rename IndexOfName_Old to Original.Otherwise convert kol 2.88 to kol 3.00,a lot of code must be changed. or define a symbol, elg USE_OLD_IndexOfName, user can control it
|