Technical data

Table Of Contents
IEC Functions
System Software for S7-300/400 System and Standard Functions - Volume 2/2
26-22
A5E00739858-01
Description FC26 MID
The function FC26 provides the middle part of a string (L characters from the
character P inclusive). If the sum of L and P exceeds the current length of the
STRING variables, a string is returned from the character P to the end of the input
value. In all other cases (P is outside the current length, P and/or L are equal to
zero or negative), a blank string is returned and the binary result (BR) bit of the
status word is set to “0".
Parameter Declaration Data Type Memory Area Description
IN INPUT STRING D, L Input variable in format STRING
L INPUT INT I, Q, M, D, L,
Const.
Length of the middle character
sting
P INPUT INT I, Q, M, D, L,
Const.
Position of first character
RET_VAL OUTPUT STRING D, L Output variable in format
STRING
You can assign only a symbolically defined variable for the parameter IN and the
return value.
Description FC31 REPLACE
The function FC31 replaces a number of characters (L) of the first string (IN1) from
the character at position P (inclusive) with the second string (IN2). If L is equal to
zero, the first string is returned. If P is equal to zero or one, the string is replaced
from the first character (inclusive). If P is outside the first string, the second string is
appended to the first string. If L and/or P is negative, a blank string is returned and
the binary result (BR) bit of the status word is set to “0". The binary result bit is also
set to “0" if the resulting string is longer than the variable given at the output
parameter; in this case the result string is limited to the maximum set length.
Parameter Declaration Data Type Memory Area Description
IN1 INPUT STRING D, L STRING variable to be replaced
in
IN2 INPUT STRING D, L STRING variable to be inserted
L INPUT INT I, Q, M, D, L,
Const.
Number of characters to be
replaced
P INPUT INT I, Q, M, D, L,
Const.
Position of first character to be
replaced
RET_VAL OUTPUT STRING D, L Result string
You can assign only a symbolically defined variable for the input parameters IN1
and IN2 and the output parameter.