Intel® Fortran Compiler 16.0 User and Reference Guide
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.
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:
|
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:
MBLGE returns .TRUE. if the strings are equal or string_a comes last in the collating sequence; otherwise, .FALSE..
MBLGT returns .TRUE. if string_a comes last in the collating sequence; otherwise, .FALSE..
MBLLE returns .TRUE. if the strings are equal or string_a comes first in the collating sequence; otherwise, .FALSE..
MBLLT returns .TRUE. if string_a comes first in the collating sequence; otherwise, .FALSE..
MBLEQ returns .TRUE. if the strings are equal in the collating sequence; otherwise, .FALSE..
MBLNE returns .TRUE. if the strings are not equal in the collating sequence; otherwise, .FALSE..
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.
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.