MatchesMask (C++)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example uses an edit box and a button on a form. When you click the button, the text inserted into the edit box is checked against a particular file name mask and then a corresponding message is displayed. The mask and an example of a string that matches it are also displayed on the form.

Code

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  if (MatchesMask(Edit1->Text, "[a-z][0-9]?[0-9]*.??[0-9]"))
    ShowMessage("File name is OK.");
  else
    ShowMessage("Invalid file name.");
}

Uses