Unicode - Character Case Mappings; Unicode - Concatenating String; Unicode - Converting Between Widechar And Char; Unicode - Using Format - AMX NETLINX STUDIO V2.4 Instruction Manual

Table of Contents

Advertisement

Unicode - 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.

Unicode - Concatenating String

Unicode strings and WIDECHAR array cannot be concatenated using the same syntax that ASCII
strings use. In NetLinx, string expressions are enclosed in double quotes and can only contain 8-bit
strings. To concatenate Unicode strings and WIDECHAR arrays, you must use the
WC_CONCAT_STRING function:
wcMyString = WC_CONCAT_STRING(_WC('First name'),_WC(' SurName'))
If you attempt to concatenate Unicode strings or WIDECHAR arrays using NetLinx string
expressions, expect data loss.

Unicode - 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)

Unicode - Using FORMAT

The NetLinx Unicode library does not include a Unicode compatible FORMAT function. In
NetLinx, the format function is used to convert numbers to text.
To use FORMAT with Unicode string, use FORMAT to convert the number to a CHAR array and
then use CH_TO_WC and WC_CONCAT_STRING to combine the result with an existing
WIDECHAR array.
The following two syntaxes are functionality equivalent:
NetLinx Studio (v2.4 or higher)
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.
Programming
101

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents