Crestron simpl plus language ref 사용자 설명서

다운로드
페이지 374
Crestron SIMPL+
®
Software 
Language Reference Guide - DOC. 5797G
 SIMPL+
®
 
z 231
SetString
Name:
SetString
Syntax:
INTEGER SetString(STRING SOURCE, INTEGER POSITION, 
STRING DESTINATION);
Description:
Overwrites the bytes in DESTINATION with the bytes in SOURCE starting at 
POSITION in the DESTINATION string.
Parameters:
DESTINATION is a STRING containing the string to be modified.
POSITION is an INTEGER referencing the starting byte to write at in 
DESTINATION. 1 is the first byte of the string.
SOURCE is a STRING containing the string to use in the operation.
Return Value:
The new length or an error code as defined below:
For the purposes of the explanation, a string has been declared STRING 
DESTINATION[MAX_LEN]. The string has a current length defined by 
LEN(DESTINATION). 
e.g., If the specified position is beyond the declared length of the destination string:
If POSITION > MAX_LEN, no operation is performed and -8 is returned.
e.g., If the entire source string can't be inserted without exceeding the length of the 
destination string:
If POSITION-1+LEN(SOURCE) > MAX_LEN, the operation is performed, the 
string is truncated and -4 is returned.
e.g., If the position exceeds the current length of the destination:
If POSITION > LEN(DESTINATION), the string is padded with spaces and -2 
is returned.
e.g., If the source string will make the destination string longer:
If POSITION-1+LEN(SOURCE) > LEN(DESTINATION), the string will be 
expanded to fit and -1 will be returned.
If the operation meets none of the above conditions, the new length is returned.
The return code may be ignored (as in the following example).
NOTE: If more than one condition is met (typically -2 and -1 would be met at the 
same time), the codes are added together as the return value.
NOTE: The subroutine knows the max length of the destination string.