SystemStrLComp (Delphi)
Description
This example requires two text edits and a button. Enter text in the two text edits and click the button to compare the strings.
Code
procedure TForm1.Button1Click(Sender: TObject);
var
S1, S2: String;
Pos: Integer;
Equal: Boolean;
begin
Pos := 1;
Equal := True;
S1 := Edit1.Text;
S2 := Edit2.Text;
Form1.Repaint;
while (Equal = True) do
begin
if StrLComp(PChar(S1), PChar(S2), Pos) = 0 then
Inc(Pos)
else
Equal := False;
end;
Canvas.TextOut(10, 10, 'The first ' + IntToStr(Pos - 1) +
' characters are equal.');
end;
Uses
- System.SysUtils.StrLComp ( fr | de | ja )