NAME

From STX Wiki
Jump to navigationJump to search

Syntax check/improvement

NAME string [ type|* [ correct ]]

Check the syntactical validity of the name string. If correct is set to 1, the command returns the name string with any invalid characters replaced by valid ones. If correct is set to 0, the command returns the name string if it is valid and an empty string if the name string is invalid.

string
The string to check for validity.
type
The type of name to check for syntactic correctness. The following values are supported:
ITEM - string should be a syntactically correct shell item name.
SEGMENT - string should be a syntactically correct segment name. See Segment Name Restrictions for details.
TABLEFIELD - string should be a syntactically correct table field name.
XMLATTRIBUTE - string should be a syntactically correct XML attribute. Note that since XML attributes are used in STx in, e.g., tables, this function also checks that are valid STx identifiers and is hence more restrictive than the XML specification.
XMLID - should be a string which conforms to the STx doctype specification for an ID attribute value.
The default is ITEM (if an asterisk is specified or the parameter is missing).
correct
1 if invalid characters should be replaced by valid characters (if string is not empty, a valid name is always returned) or 0 if an empty string should be returned if invalid characters are found.
The default is 0.
// correct the segment name $#name
#name := set $(NAME $#name segment 1)

UNC Path

NAME filepath UNC [ copy ]

If filepath points to a file on a mapped network drive, then the UNC (Uniform Naming Convention) file path to this file is returned. If filepath does not exist, is not a file, or is not on a mapped network drive, an empty string is returned.

copy
If copy is set to 1, and there is no corresponding UNC file path for filepath, then filepath is returned.
If copy is set to 0, and there is no corresponding UNC file path for filepath, an empty string is returned.
// if the z drive is mapped to \\server1\data, then '\\server1\data\ds.xml' is returned
#uncfilename := name 'z:\ds.xml' unc
// if the z drive is *not* mapped to \\server1\data, then an empty string is returned
#uncfilename := name 'z:\ds.xml' unc
// if the z drive is *not* mapped to \\server1\data, then 'z:\ds.xml' is returned
#uncfilename := name 'z:\ds.xml' unc 1

Navigation menu

Personal tools