Intel® Fortran Compiler 18.0 Developer Guide and Reference

MBLGE, MBLGT, MBLLE, MBLLT, MBLEQ, MBLNE (W*S)

NLS Functions: Perform the same functions as LGE, LGT, LLE, LLT and the logical operators .EQ. and .NE. except that the strings being compared can include multibyte characters, and optional flags can modify the comparison.

Module

USE IFNLS

result = MBLGE (string_a,string_b, [ flags])

result = MBLGT (string_a,string_b, [ flags])

result = MBLLE (string_a,string_b, [ flags])

result = MBLLT (string_a,string_b, [ flags])

result = MBLEQ (string_a,string_b, [ flags])

result = MBLNE (string_a,string_b, [ flags])

string_a, string_b

(Input) Character*(*). Strings to be compared. Can contain multibyte characters.

flags

(Input; optional) INTEGER(4). If specified, determines which character traits to use or ignore when comparing strings. You can combine several flags using an inclusive OR (IOR or OR). There are no illegal combinations of flags, and the functions may be used without flags, in which case all flag options are turned off. The available values (defined in IFNLS.F90) are:

  • NLS$MB_IgnoreCase - Ignore case.

  • NLS$MB_IgnoreNonspace - Ignore nonspacing characters (this flag removes Japanese accent characters if they exist).

  • NLS$MB_IgnoreSymbols - Ignore symbols.

  • NLS$MB_IgnoreKanaType - Do not differentiate between Japanese Hiragana and Katakana characters (corresponding Hiragana and Katakana characters will compare as equal).

  • NLS$MB_IgnoreWidth - Do not differentiate between a single-byte character and the same character as a double byte.

  • NLS$MB_StringSort - Sort all symbols at the beginning, including the apostrophe and hyphen (see the Note below).

Results

The result type is LOGICAL(4). Comparisons are made using the current locale, not the current codepage. The codepage used is the default for the language/country combination of the current locale.

The results of these functions are as follows:

If the two strings are of different lengths, they are compared up to the length of the shortest one. If they are equal to that point, then the return value indicates that the longer string is greater.

If flags is invalid, the functions return .FALSE..

If the strings supplied contain Arabic Kashidas, the Kashidas are ignored during the comparison. Therefore, if the two strings are identical except for Kashidas within the strings, the functions return a value indicating they are "equal" in the collation sense, though not necessarily identical.

NOTE

When not using the NLS$MB_StringSort flag, the hyphen and apostrophe are special symbols and are treated differently than others. This is to ensure that words like coop and co-op stay together within a list. All symbols, except the hyphen and apostrophe, sort before any other alphanumeric character. If you specify the NLS$MB_StringSort flag, hyphen and apostrophe sort at the beginning also.

See Also