0% found this document useful (0 votes)
191 views

S7 String Compare Functions

This document provides information on string comparison functions in STEP 7. It describes 9 functions - FC10 EQ_STRNG, FC13 GE_STRNG, FC15 GT_STRNG, FC19 LE_STRNG, FC24 LT_STRNG, FC29 NE_STRNG - that compare string variables and return a boolean result. All functions take string inputs S1 and S2, return a boolean value indicating the comparison result, and do not report errors. The strings are compared character by character based on ASCII codes.

Uploaded by

KAMİL ÇİFCİ
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
191 views

S7 String Compare Functions

This document provides information on string comparison functions in STEP 7. It describes 9 functions - FC10 EQ_STRNG, FC13 GE_STRNG, FC15 GT_STRNG, FC19 LE_STRNG, FC24 LT_STRNG, FC29 NE_STRNG - that compare string variables and return a boolean result. All functions take string inputs S1 and S2, return a boolean value indicating the comparison result, and do not report errors. The strings are compared character by character based on ASCII codes.

Uploaded by

KAMİL ÇİFCİ
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

*HQHUDO,QIRUPDWLRQ 

&RPSDULQJ675,1*9DULDEOHV

27.7 Comparing STRING Variables

Description FC10 EQ_STRNG


The function FC10 compares the contents of two variables in the data type format STRING to find out
if they are equal and outputs the result of the comparison as a return value. The return value has the
signal state ”1" if the string at parameter S1 is the same as the string at parameter S2.
The function does not report any errors.

Parameter Declaration Data Type Memory Area Description


S1 INPUT STRING D, L Input variable in format STRING
S2 INPUT STRING D, L Input variable in format STRING
RET_VAL OUTPUT BOOL I, Q, M, D, L Result of comparison

You can assign only a symbolically defined variable for the input parameters.

Description FC13 GE_STRNG


The function FC13 compares the contents of two variables in the data type format STRING to find out
if the first is greater than or equal to the other and outputs the result of the comparison as a return
value. The return value has the signal state ”1" if the string at parameter S1 is greater than or equal to
the string at parameter S2.
The characters are compared by their ASCII code (for example, 'a' is greater than 'A'), starting from
the left. The first character to be different decides the result of the comparison. If the first characters
are the same, the longer string is greater.
The function does not report any errors.

Parameter Declaration Data Type Memory Area Description


S1 INPUT STRING D, L Input variable in format STRING
S2 INPUT STRING D, L Input variable in format STRING
RET_VAL OUTPUT BOOL I, Q, M, D, L Result of comparison

You can assign only a symbolically defined variable for the input parameters.

System Software for S7-300/400 System and Standard Functions Volume 2/2
572 Reference Manual, 05/2010, A5E02790053-01
 *HQHUDO,QIRUPDWLRQ
&RPSDULQJ675,1*9DULDEOHV

Description FC15 GT_STRNG


The function FC15 compares the contents of two variables in the data type format STRING to find out
if the first is greater than the other and outputs the result of the comparison as a return value. The
return value has the signal state ”1" if the string at parameter S1 is greater than the string at parameter
S2.
The characters are compared by their ASCII code (for example, 'a' is greater than 'A'), starting from
the left. The first character to be different decides the result of the comparison. If the first characters
are the same, the longer string is greater.
The function does not report any errors.

Parameter Declaration Data Type Memory Area Description


S1 INPUT STRING D, L Input variable in format STRING
S2 INPUT STRING D, L Input variable in format STRING
RET_VAL OUTPUT BOOL I, Q, M, D, L Result of comparison

You can assign only a symbolically defined variable for the input parameters.

FC19 LE_STRNG
The function FC19 compares the contents of two variables in the data type format STRING to find out
if the first is smaller than or equal to the other and outputs the result of the comparison as a return
value. The return value has the signal state ”1" if the string at parameter S1 is smaller than or equal to
the string at parameter S2.
The characters are compared by their ASCII code (for example, 'a' is smaller than 'A'), starting from
the left. The first character to be different decides the result of the comparison. If the first characters
are the same, the shorter string is smaller.
The function does not report any errors.

Parameter Declaration Data Type Memory Area Description


S1 INPUT STRING D, L Input variable in format STRING
S2 INPUT STRING D, L Input variable in format STRING
RET_VAL OUTPUT BOOL I, Q, M, D, L Result of comparison

You can assign only a symbolically defined variable for the input parameters.

System Software for S7-300/400 System and Standard Functions Volume 2/2
A5E02790053-01 573
*HQHUDO,QIRUPDWLRQ 
&RPSDULQJ675,1*9DULDEOHV

Description FC24 LT_STRNG


The function FC24 compares the contents of two variables in the data type format STRING to find out
if the first is smaller than the other and outputs the result of the comparison as a return value. The
return value has the signal state ”1" if the string at parameter S1 is smaller than the string at
parameter S2.
The characters are compared by their ASCII code (for example, 'a' is smaller than 'A'), starting from
the left. The first character to be different decides the result of the comparison. If the left part of the
longer character string and the shorter character string are the same, the shorter string is smaller.
The function does not report any errors.

Parameter Declaration Data Type Memory Area Description


S1 INPUT STRING D, L Input variable in format STRING
S2 INPUT STRING D, L Input variable in format STRING
RET_VAL OUTPUT BOOL I, Q, M, D, L Result of comparison

You can assign only a symbolically defined variable for the input parameters.

Description FC29 NE_STRNG


The function FC29 compares the contents of two variables in the data type format STRING and
checks to see that they are not the same and outputs the result of the comparison as a return value.
The return value has the signal state ”1" if the string at arameter S1 is not the same as the string at
parameter S2.
The function does not report any errors.

Parameter Declaration Data Type Memory Area Description


S1 INPUT STRING D, L Input variable in format STRING
S2 INPUT STRING D, L Input variable in format STRING
RET_VAL OUTPUT BOOL I, Q, M, D, L Result of comparison

You can assign only a symbolically defined variable for the input parameters.

System Software for S7-300/400 System and Standard Functions Volume 2/2
574 Reference Manual, 05/2010, A5E02790053-01

You might also like