The string data types include:
● String - a fixed size buffer or variable length buffer of Char type each contain an ASCII character
● BString - variable length buffer of WChar type each contain a Unicode character
The default value for all string data types is an empty string ("").
A String data type is a sequence of zero or more characters. All Strings have a Length (number of characters used by the String) and a Size (number of characters used in memory). Internally, the length of a string is stored in a header that precede the buffer holding the characters. When defining a string in ATEasy, you can specify its size in the Variable Properties window to define it as a fixed size string. If you did not specify the size, it is a variable string (default) and ATEasy will reallocate the size for it as needed when the length is changes.
When you assign a string to a string the string length is set. You can also set the length or get it using the SetLen() and length and Len() internal procedures. When changing the string length, ATEasy stores a null character after the length so when passing it to a DLL, it will be null terminated, this null characters is not used to determine it length within ATEasy and in ATEasy a string can contain null characters within its length. This is useful since many times you need to send or receive a string that contain a null character to/from a device. When calling a DLL procedure with a VAR String parameter, ATEasy use the returned string buffer null character location to set the length of the string.
Example:
s="This a is a string.\r\nWith two lines."
s="abc\0def"
print Len(s) ! 7
BString is a string of 16-bit characters (each a 2 byte Unicode WChar type). BString is used commonly to send or receive data from COM objects outside of ATEasy. The data type holds Unicode characters. Internally, the data is preceded with a header contains a character count, for example:
header |
Now is the time to do the work. |
Basic Data Types, Data Conversion, Numeric, User Defined Date Types, String Literals