IMcOMGlobalMcCStr Method
|
|
Converts C-style escape sequences in a string into the special characters.
Namespace:
MediaCy.IQL.ObjectManager
Assembly:
MediaCy.IQL.ObjectManager (in MediaCy.IQL.ObjectManager.dll) Version: 10.0.6912.0
SyntaxFunction McCStr (
StringWithEscapeChars As String
) As String
Parameters
- StringWithEscapeChars
- Type: SystemString
The source string with C-style escape
characters. The source string is not modified.
Return Value
Type:
StringThe result string with each escape sequence replaced by
the corresponding special character. This string will never be longer
than the StringWithEscapeChars, and it may be shorter.
RemarksOne of the more irritating things about Visual Basic is that there is
no mechanism for placing special characters such as carriage return, line feed
or tab into a string. Instead you need to concatenate strings with the special
characters. The C language has a much better approach, since it allows you to
embed special characters in a string by use of "escape sequences". A C-style
escape sequence always starts with a backslash. Each escape sequence resolves
to one character.
The following list gives the supported escape sequences and the character that
they encode.
\a Bell (alert) (decimal 7, hex \x07, octal \007)
\b Backspace (decimal 8, hex \x08, octal \010)
\f Formfeed (decimal 12, hex \x0c, octal \014)
\n New line (decimal 10, hex \x0a, octal \012)
\r Carriage return (decimal 13, hex \x0d, octal \015)
\t Horizontal tab (decimal 9, hex \x09, octal \011)
\v Vertical tab (decimal 11, hex \x0b, octal \013)
\\ Backslash (decimal 92, hex \x5c, octal \134)
\ooo ASCII character in octal notation (see examples above)
\xhhh ASCII character in hexadecimal notation (see examples above)
If a backslash precedes a character that does not appear in the list above, the
compiler handles the undefined character as the character itself. For example,
\z is treated as a z. Note that in order to place a backslash into a string
with escape sequences, you must place "\\" for each "\" that you wish to
preserve.
For the octal (\ooo) and hexadecimal (\xhhh) escape sequences, the
numeric part is taken up to the first non-octal or non-hexadecimal digit,
respectively, so you may supply as many digits as you like. However, the ASCII
character codes from 1-255 can be represented in three octal digits (\001-\377)
and or two hexadecimal digits (\x00-\xff). Since the numeric encoding sequence
can be confusing, it is suggested that you always supply 3 octal digits or 2
hexadecimal digits.
ExamplesDebug.Print McCStr("Line 1.\nLine 2.\nIs this a \x4b, this a \113, and this a K?")
Debug.Print McCStr()
See Also