Unicode Compatible Functions; Converting Between Widechar And Char; Defining A Unicode String Literal; Storing A Unicode String - AMX NetLinx Studio Instruction Manual

Netlinx design v3.3 or higher
Table of Contents

Advertisement

Programming

Unicode Compatible Functions

The list of Unicode compatible functions is:
WC_COMPARE_STRING
WC_GET_BUFFER_CHAR
WC_GET_BUFFER_STRING
WC_LEFT_STRING
WC_FIND_STRING
WC_LENGTH_STRING
WC_LOWER_STRING

Converting Between WIDECHAR and CHAR

On occasion, you may need to convert a CHAR array to a WIDECHAR array or a WIDECHAR array to a CHAR array. The
CH_TO_WC and WC_TO_CH functions can be used to accomplish these conversions.
For example:
wcMyString = CH_TO_WC('Any ASCII string')
wcMyString = CH_TO_WC(cMyString)
cMyString = WC_TO_CH(_WC('Any Unicode string'))
cMyString = WC_TO_CH (wcMyString)




Defining a Unicode String Literal

To enter Unicode characters into your program, enclose the characters in single quotes, like you would any other string,
and wrap the string literal in the Unicode macro _WC.
Example:
_WC('Your string goes here')
All Unicode string literals must be wrapped in the _WC macro. Failing to wrap a
Unicode string in the _WC macro will result in a compiler error.

Storing a Unicode String

Unicode strings are stored in WIDECHAR arrays, similar to the way ASCII strings are stored in CHAR arrays.
To define a WIDECHAR constant or variable and initialize it using a Unicode string literal, use the following syntax:
WIDECHAR wcMyString[] = _WC('My String')
The "wc" prefix is Hungarian notation for widechar. This is simply a programming
convention and is completely optional. Hungarian notation helps you better identify
your variables while you are programming and is a general recommended standard.
For more information, see Wikipedia's Hungarian Notation page.

Character Case Mappings

Converting between upper and lower case is accomplished by using the Unicode.org character database to determine the
mapping between upper case and lower case characters.
Not all Unicode characters have an upper or lower case equivalent; these characters will not be affected by
WC_UPPER_STRING and WC_LOWER_STRING. Only the characters defined by Unicode.org as having an upper or
lower case mapping are affected by these functions.
For more information on Unicode character conversion, see the Unicode.org
character conversion FAQ.
100
When converting from WIDECHAR to CHAR, Unicode characters are converted to '?'.
Any ASCII or extended ASCII characters, i.e. 8-bit characters, contained in the WIDECHAR array will appear
in the CHAR array.
Converting from CHAR to WIDECHAR never results in loss of data.
WC_MAX_LENGTH_STRING
WC_MID_STRING
WC_REMOVE_STRING
WC_RIGHT_STRING
WC_SET_LENGTH_STRING
WC_UPPER_STRING
NetLinx Studio - Instruction Manual

Advertisement

Table of Contents
loading

Table of Contents