System.SysUtils.TStringHelper.CompareTo

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function CompareTo(const strB: string): Integer;

Properties

Type Visibility Source Unit Parent
function public System.SysUtils.pas System.SysUtils TStringHelper

Description

Compares this string against a given string.

CompareTo compares with case-sensitivity and returns:

  • < 0 if the string sorts before StrB
  • 0 if the string is the same as StrB
  • > 0 if the string sorts after StrB
var
  MyStringA, MyStringB: String;

begin
  MyStringA := 'String A';
  MyStringB := 'String B';

  Writeln(Boolean(MyStringA.CompareTo(MyStringB) = 0));
end.

Output:

FALSE

See Also