Programming
100
NetLinx Studio (v2.4 or higher)
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')
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')
Working With Widechar Arrays and Unicode Strings
Working with WIDECHAR arrays and Unicode strings is very similar to working with CHAR
arrays and ASCII strings. Most operation that can be performed on a CHAR array can be
performed on a WIDECHAR array. For instance, to assign a string to a variable use this syntax:
wcMyString = _WC('My String')
The string functions defined for CHAR arrays have been defined for WIDECHAR array for use in
Unicode programming. These functions allow you to operate on strings similar to the way you
would with CHAR array. For instance, to remove the first 3 characters from a WIDECHAR array
and return those characters as a WIDECHAR array, use WC_GET_BUFFER_STRING:
wcRemoved = WC_GET_BUFFER_STRING(wcMyString,3)
You will find that most other function work exactly as their CHAR counterpart do except they work
on and return WIDECHAR arrays. 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
WC_MAX_LENGTH_STRING
WC_MID_STRING
WC_REMOVE_STRING
WC_RIGHT_STRING
WC_SET_LENGTH_STRING
WC_UPPER_STRING
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.
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.
Summary of Contents for NETLINX STUDIO V2.4
Page 1: ...instruction manual Software NetLinx Studio v2 4 or higher ...
Page 16: ...NetLinx Studio v2 4 or higher 4 NetLinx Studio v2 4 or higher ...
Page 32: ...The NetLinx Studio v2 4 Work Area 20 NetLinx Studio v2 4 or higher ...
Page 44: ...Working With Workspace Files 32 NetLinx Studio v2 4 or higher ...
Page 88: ...Working With Systems and System Files 76 NetLinx Studio v2 4 or higher ...
Page 118: ...Programming 106 NetLinx Studio v2 4 or higher ...
Page 152: ...Working With Online Devices 140 NetLinx Studio v2 4 or higher ...