Scripting > UNICOM Intelligence Function Library > Text functions > MakeMDMName
 
MakeMDMName
This function replaces characters in a text string that are not allowed in the name of an MDM object, to produce a valid name.
Syntax
MakeMDMName(Val)
Parameters
Val
Type: Text
Text value to encode.
(return)
Type: None
Copy of Val with changes to make it a valid name for an MDM object.
Remarks
The following changes are made:
Leading and trailing spaces are removed.
Null, blank, or empty names are converted to “No_name__”.
Any occurrence of the character # is replaced by #23 (23 is the hexadecimal representation of the Unicode character code for #).
Any character that is not allowed anywhere in an MDM name is replaced by # followed by its two-digit hexadecimal character code.
If the resulting text starts with any character that is not allowed at the start of an MDM name, then the string _#00 is inserted at the start of the text.
These conversions ensure that:
The resulting text is a valid MDM name.
Different input strings always produce distinct output strings.
It is possible to “decode” the resulting text to get the original (although no library function is provided to do this).
Examples
Original
After using MakeMDMName
domain\username
domain#5Cusername
user@domain.com
user@domain#2Ecom
\\machine\file
_#00#5C#5Cmachine#5Cfile
Neither agree nor disagree
Neither#20agree#20nor#20disagree
12
_#0012
Under $12
Under#20$12
See also
AscW
Text functions