Partilhar via


TreeNode.isValidObjectName(String) Method

Definition

Determines whether the string passed as an argument can be used as a name for a node in the Application Object Tree (AOT).

public:
 static bool isValidObjectName(System::String ^ _name);
public static bool isValidObjectName (string _name);
static member isValidObjectName : string -> bool
Public Shared Function isValidObjectName (_name As String) As Boolean

Parameters

_name
String

The string that contains the tree node name to validate.

Returns

true if each condition is met; otherwise false.

Remarks

A candidate name must meet the following conditions:

  • The first character must be a letter.
  • It can only contain letters, numbers or an underscore.
  • It must not evaluate to a token.

This method does not check if an element of the same name already exists. It only validates that the argument is a valid name for an AOT object. Duplicate names may not exist within classes, tables, extended data types, or enums.

The following example gives examples of valid and invalid arguments.

boolean validName; 
validName = TreeNode::isValidObjectName('ValidName'); //true 
validName = TreeNode::isValidObjectName('Name with spaces'); //false 
validName = TreeNode::isValidObjectName('4StartsWithDigit'); //false 
validName = TreeNode::isValidObjectName('Illegal;Character'); //false 
validName = TreeNode::isValidObjectName('if'); // false (token name)

Applies to