[This is preliminary documentation and subject to change.]
The MOF language supports the following string data types:
Data type | Automation type | Description |
---|---|---|
Char16 | VT_I2 | Single 16-bit UCS-2 Unicode character |
Datetime | VT_BSTR | String containing a date and time in DMTF format |
String | VT_BSTR | Unicode character string |
Single character constants are surrounded by single quotes or else the integer representation of the UNICODE character value can be used directly:
char16 TestChar1 = '\x41';
char16 Testchar2 = 'A';
char16 TestChar3 = 65;
char16 TestChar4 = 0x1000;
Note that characters can be specified literally or with the \x escape sequence as in ANSI-C. Since the characters are Unicode, 16-bit values can also be specified.
Character strings are surrounded by double quotes. Note that ANSI-C single character constants are surrounded by double quotes.
Successive quoted strings are concatenated with one or more white spaces placed between them as delimiters. The following example illustrates how to represent a long character string using two character strings:
"This" "becomes a long string"
Embedded quotes require the use of an escape sequence beginning with the backslash:
"This is \"embedded quote example\" "
Because character and short integer values are identical, character constants can be assigned integer values if the values are within the 16-bit range of an unsigned Unicode character. The following class and instance declarations show how to initialize several string properties and a string parameter.
class StringDataClass
{
[KEY] String Dstring;
DateTime DTime;
sint16 CharVal1;
sint16 CharVal2
sint32 DiskMethod ([in] string Description = "Disk Number 1");
};
instance of StringDataClass
{
Dstring = "this can go on for " " some time"
" before we are done";
DTime = "19940107140332.000000-300";
CharVal1 = '\n';
CharVal2 = '\x32';
};