Quantcast

Documentation Center

  • Trial Software
  • Product Updates

stringlib::validIdent

Validate identifier name

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

stringlib::validIdent(string)

Description

stringlib::validIdent(string) returns TRUE, when string is a valid identifier name, otherwise FALSE.

A valid identifier name in MuPAD® must follow the rules:

  • The first character must be a letter or the character "_".

  • All following characters must be letters or digits or the character "_".

  • An identifier consists of at least one character up to 512 characters.

Names in backticks ` are not determined as valid names.

Examples

Example 1

The example splits a set of names into valid identifier names and invalid identifier names:

split({"a", "1", "_111", "____", "A0b.C", "MuPAD", "1ABCDE", "xyz00"},
      stringlib::validIdent)

stringlib::random called with option Name returns always valid identifier names. The function map applies stringlib::validIdent to each of the 1000 generated random names:

map({stringlib::random(1..10, Name) $ k = 1..1000},
    stringlib::validIdent)

Parameters

string

A string

Return Values

TRUE or FALSE

See Also

MuPAD Functions

Was this topic helpful?