compare - UDM Command

Syntax

compare STRING_1 STRING_2 [case=yes|no] [length=length]

Description

The compare command compares two strings.

The first two parameters (STRING_1 and STRING_2) are the strings to be compared.

The optional case parameter specifies whether the comparison is case-sensitive (yes) or case-insensitive (no). Default = no.

If the length parameter is set, only the first n characters are compared.

The _lastrc.result variable receives the result of the comparison:

  • If the strings match, 0 is stored in the result.
  • If the strings do not match, the index of the point at which the comparison failed is stored as the result.

The _lastrc.message built-in variable contains MATCH if the strings are equal; it contains NO_MATCH if the strings are not equal.

Parameters

Parameter

Description

STRING_1

String to be compared to STRING_2.

STRING_2

String to be compared to STRING_1.

case=yes | no

Specification for whether or not the comparison is case-sensitive:

  • If set to yes, comparison is case-sensitive.
  • If set to no, comparison is not case-sensitive.

Note

If case is not used, the comparison is case insensitive.

length=length

First n characters to be compared.