CompareStr (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following code compares String1, 'ઘ૯યજE', to String2, 'ઘ૯યજe'. Note that CompareStr returns a number less than 0 because the value of 'e' is greater than the value of 'E'.

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  String String1 = "ઘ૯યજE";
  String String2 = "ઘ૯યજe";
  int I = CompareStr(String1, String2);  // The value of I is less than 0.
  Edit1->Text = IntToStr(I);
  if (I != 0)
	ShowMessage ("The strings are not equal");
}

Uses