Programmer Guide/Command Reference/NAME: Difference between revisions
(initial import) |
m (1 revision: Initial import) |
(No difference)
|
Revision as of 17:31, 18 November 2010
NAME
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.
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 S_TOOLS-STx in, e.g., tables, this function also checks that are valid S_TOOLS-STx identifiers and is hence more restrictive than the XML specification.
XMLID
- should be a string which conforms to the S_TOOLS-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) or0
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)
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. E.g.:
- 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.
<code>// if the z drive is mapped to \\server1\data, then '\\server1\data\ds.xml' is returned</code> <code>#uncfilename := name 'z:\ds.xml' unc</code> <code>// if the z drive is *not* mapped to \\server1\data, then an empty string is returned</code> <code>#uncfilename := name 'z:\ds.xml' unc</code> <code>// if the z drive is *not* mapped to \\server1\data, then 'z:\ds.xml' is returned</code> <code>#uncfilename := name 'z:\ds.xml' unc 1</code>