Skip to main content

Follows (])

Tests whether the characters in the left operand come after the characters in the right operand in ASCII collating sequence.

Details

The Follows operator tests whether the characters in the left operand come after the characters in the right operand in ASCII collating sequence. Follows tests both strings starting with the left most character in each. The test ends when either:

  • A character is found in the left operand that is different from the character at the corresponding position in the right operand.

  • There are no more characters left to compare in either of the operands.

ObjectScript returns a value of TRUE if the first unique character in the left operand has a higher ASCII value than the corresponding character in the right operand (that is, if the character in the left operand comes after the character in the right operand in ASCII collating sequence.) If the right operand is shorter than the left operand, but otherwise identical, ObjectScript also returns a value of TRUE.

ObjectScript returns a value of FALSE if any of the following conditions prevail:

  • The first unique character in the left operand has a lower ASCII value than the corresponding character in the right operand.

  • The left operand is identical to the right operand.

  • The left operand is shorter than the right operand, but otherwise identical.

Examples

The following example tests whether the string LAMPOON follows the string LAMP in ASCII collation order. The result is TRUE.

 WRITE "LAMPOON"]"LAMP"

The following example tests whether the string in B follows the string in A. Because BO follows BL in ASCII collation sequence, the result is TRUE.

 SET A="BLUE",B="BOY" 
 WRITE B]A
FeedbackOpens in a new tab