随笔 - 2146  文章 - 97 评论 - 11765 trackbacks - 253

CompareStr 区分大小写; CompareText 不区分大小写. 举例:
var
  s1,s2: string;
  i: Integer;
begin
  s1 := 'abc';
  s2 := 'adc';
  i := CompareStr(s1,s2);
  ShowMessage(IntToStr(i));  {-2}

  i := CompareText(s1,s2);
  ShowMessage(IntToStr(i));  {-2}

  s1 := 'abc';
  s2 := 'ABC';
  i := CompareStr(s1,s2);    {CompareStr 区分大小写}
  ShowMessage(IntToStr(i));  {32}

  i := CompareText(s1,s2);   {CompareText 不区分大小写}
  ShowMessage(IntToStr(i));  {0}
end;

SysUtils 单元下的公用函数目录

posted on 2008-03-31 21:38  万一  阅读(...)  评论(... 编辑 收藏