Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This algorithm compares two UTF-16 strings by doing an ordinal (binary) comparison. Optionally, the caller can request that the comparison be done on the uppercase form of the string.
-
COMMENT CompareStringOrdinal COMMENT On Entry: StringA – A UTF-16 string to be compared COMMENT On Entry: StringB – Second UTF-16 string to compare COMMENT On Entry: IgnoreCaseFlag – TRUE to ignore case when comparing COMMENT COMMENT On Exit: Result – A value indicating if StringA is less than, COMMENT equal to, or greater than StringB PROCEDURE CompareStringOrdinal IF IgnoreCaseFlag is TRUE THEN SET StringA TO ToUpperCase(StringA) SET StringB TO ToUpperCase(StringB) ENDIF SET index TO 0 WHILE index is less than Length(StringA) and index is also less than Length(StringB) IF StringA[index] is less than StringB[index] THEN SET Result TO "StringA is less than StringB" RETURN ENDIF IF StringA[index] is greater than StringB[index] THEN SET Result TO "StringA is greater than StringB" RETURN ENDIF INCREMENT index ENDWHILE IF Length(StringA) is equal to Length(StringB) THEN SET Result TO "StringA is equal to StringB" ELSE IF Length(StringA) is less than Length(StringB) THEN SET Result TO "StringA is less than StringB" ELSE Assert Length(StringA) has to be greater than Length(StringB) SET Result TO "StringA is greater than StringB" ENDIF RETURN