SysUtilsStrLIComp (C++)
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 without case sensitivity.
Code
#include <algorithm> // For the min function
#include <memory> // For STL auto_ptr class
void __fastcall TForm1::Button1Click(TObject *Sender)
{
int len = std::min(Edit1->Text.Length(), Edit2->Text.Length());
int iResult = StrLIComp(Edit1->Text.c_str(), Edit2->Text.c_str(), len);
String result = String().sprintf(L"The first %d characters of %ls", len, Edit1->Text);
if (iResult < 0)
result += " are less than ";
else if (iResult > 0)
result += " are greater than ";
else
result += " are equal to ";
result += String().sprintf(L"the first %d characters of %ls", len, Edit2->Text);
ShowMessage(result);
}
Uses
- System.SysUtils.StrLIComp ( fr | de | ja )