Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

MBLGE, MBLGT, MBLLE, MBLLT, MBLEQ, MBLNE

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. These routines are only available for Windows.

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*(*). Are the strings to be compared. It 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:

  • 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.

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