[文字列を比較する]

文字列を比較します。
【ソースコード】 [tips0020.pas]
program tips0020;
{$APPTYPE CONSOLE}
uses SysUtils;
var
 a:String;
 b:String;

begin
 a:='ABC';
 b:='ABC';

 WriteLn('AnsiCompareStrで文字列比較');
 if(AnsiCompareStr(a,b)=0) then
   WriteLn(' →同じ文字列です。')
 else
   WriteLn(' →異なる文字列です。');

 WriteLn('=で文字列比較');
 if(a=b) then
   WriteLn(' →同じ文字列です。')
 else
   WriteLn(' →異なる文字列です。');
 
end.
【コンパイル&実行】 [tips0020.bat]
dcc32 tips0020.pas 
tips0020.exe  > tips0020.txt
pause
【実行結果】 [tips0020.txt]
AnsiCompareStrで文字列比較
 →同じ文字列です。
=で文字列比較
 →同じ文字列です。