IFNSTRCMP        Branch to label if two strings do not match

Top  Previous  Next

Syntax:

IFNSTRCMP

[ string1 ]  [ string2 ]  GOTO  [ label ]

Alt Syntax:

IFNSTRCMPI

[ string1 ]  [ string2 ]  GOTO  [ label ]

Arguments:

[ string1 ]

Variable or string defining first string to compare.

 

[ string2 ]

Variable or string defining second string to compare.

 

[ label ]

A valid label within the current script file which is branched to if the two strings do not match.

Options:

none

 

 

 

This script command compares two strings and branches to [ label ] if they are not exactly the same.

 

Use the alternate IFNSTRCMPI command to perform the same comparison but to ignore case during the comparison. Unlike the UPPER and LOWER commands, IFNSTRCMPI does not change the case of the strings.

 

Consider the following example in which the script file accepts a string from a user prompt and branches to a label if the string is not what is expected.

 

PROMPT serial_number "Enter serial number"

IFNSTRCMP serial_number "010101" GOTO invalidnumber

 

 

Related command(s): IFSTRCMP, IFSUBSTR, IFNSUBSTR, UPPER, LOWER