Конференция "KOL" » StrComp_NoCase,StrLComp_NoCase bug?
 
  • f417support © (22.01.11 04:01) [0]
    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;
  • Vladimir Kladov © (22.01.11 11:28) [1]
    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?
  • f417support © (23.01.11 10:35) [2]
    my windows's language is chinese, msgok is called
  • Vladimir Kladov © (23.01.11 14:29) [3]
    #$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).
  • f417support © (24.01.11 03:14) [4]
    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?
  • f417support © (24.01.11 03:24) [5]
    if StrComp_NoCase(#$EA, #$EB) = 0 then
       MsgOK('equal');

    MsgOk will be called in chinese windows
  • Vladimir Kladov © (24.01.11 15:30) [6]
    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.
  • f417support © (25.01.11 03:53) [7]
    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
 
Конференция "KOL" » StrComp_NoCase,StrLComp_NoCase bug?
Есть новые Нет новых   [120354   +32][b:0][p:0.001]