Topic: DMD0164 STRCMP - String Compare |
|
The String Compare (STRCMP) instruction will compare the contents of one String to the contents of a second String or to a String Literal Zero or more characters enclosed in double quotes, as in "hello", and may include both simple escape sequences (such as \t for the tab character) and hexadecimal data (such as 0xAA).. The instruction determines if two Strings are Equal, Less Than or Greater Than by comparing the byte values of the characters in the respective Strings. The byte value of a String or a string literal is the decimal values assigned to each character. The byte values for each character can be seen in the ASCII Character Table.
The instruction compares the byte values for the characters in order
until one of the following happens:
|
|
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.
First String - this can be any User-defined or System-defined String.
Set If Equal - if this option is selected the First String and the Second String must be equal to set the designated BIT location ON. This can be any writable bit location.
Set If Less Than - if this option is selected the First String must be less than the Second String to set the designated BIT location ON. This can be any writable bit location.
Set If Greater Than - if this option is selected the First String must be greater than the Second String to set the designated BIT location ON. This can be any writable bit location.
Second String or Text - this can be any User-defined or System-defined String or a String Literal Zero or more characters enclosed in double quotes, as in "hello", and may include both simple escape sequences (such as \t for the tab character) and hexadecimal data (such as 0xAA)..
Input Leg selects which of the following power-flow conditions will cause this instruction to run:
|
|
Status Display:
The Status display of the String Compare instruction will only display as many of the characters of the First String and Second String or Text 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
STRCMP - String Compare
STRCOPYR - Copy a Range of Strings
|
|
Related Topics:
String Scripting Language Reference
|
|
Rung Example:
|
|