IsValidIdent

Check whether a string is a valid identifier name.

Declaration

Source position: sysstrh.inc line 114

  function IsValidIdent(const Ident: string; AllowDots: Boolean; 
                       StrictDots: Boolean) : Boolean;

Description

IsValidIdent returns True if Ident can be used as a component name. It returns False otherwise. Ident must consist of a letter or underscore, followed by a combination of letters, numbers or underscores to be a valid identifier.

Errors

None.

Example

Program Example75;
{ This program demonstrates the IsValidIdent function }
Uses sysutils;
Procedure Testit (S : String);
begin
  Write ('"',S,'" is ');
  If not IsVAlidIdent(S) then
    Write('NOT ');
  Writeln ('a valid identifier');
end;
Begin
  Testit ('_MyObj');
  Testit ('My__Obj1');
  Testit ('My_1_Obj');
  Testit ('1MyObject');
  Testit ('My@Object');
  Testit ('M123');
End.