Topic: DMD0173 STRTRUNC - Set String Length |
|
The Set String Length (STRTRUNC) instruction will set the length of a String to the specified number of characters.
|
|
Parameters:Note: Use the F9 key or click the 'three dot box' at the right edge of the parameter field to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.
String - the String to set the length of. This can be any writable user-defined or system-defined String.
Length - specifies the length (in characters) to make the String. This can be any readable numeric location, or a constant value between 0 and the maximum length of the String.
If a length of 0 is specified this will set the length to 0.
If a negative length is specified, the length will be set to the maximum length of the String, and a "Buffer Overflow" Warning message will be generated.
If the specified length is longer than the current length of the String (<string>.Length), the length will be set to specified value, and the current string will be padded with NULL characters (0x00), not spaces.
If the specified length is longer than the maximum length of the String (<string>.MaxLen), the length will be set to the maximum length of the String, the current string will be padded with NULL characters (0x00), a "Buffer Overflow" Warning message will be generated
|
|
Status Display:Before executing the STRTRUNC instruction:
After Executing the STRTRUNC instruction:
The Status display will only show as many of the characters of the String as will fit within the borders of the instruction, typically this is about 50 characters.
|
|
See Also:STR2REAL - Convert String to Real
STR2INT - Convert String to Integer
STRCASE - Convert String to UPPER / lower Case
STRCOPYR - Copy a Range of Strings
|
|
Related Topics:
String Scripting Language Reference
|
|
Rung Example:
|
|