cistrcmp Function

public pure function cistrcmp(str1, str2) result(res)

Case-independent string comparison. It works with this dataset: 'aáäàâbcdeéëèêfghiíïìîjklmnñoóöòôpqrstuúüùûvwxyz'

Syntax

 l = cistrcmp(str1, str2)

Where:

  • str1: First string to compare.
  • str2: Second string to compare.

It returns True if both strings are equal independently of the case and False otherwise.

Example

The following program performs a case-independent string comparison:

 PROGRAM cistrcmpExample
    USE FU_Strings, ONLY: cistrcmp
    IMPLICIT NONE
    CHARACTER(LEN=:), ALLOCATABLE :: text1, text2
    text1 = 'String1'
    text2 = 'string1'
    IF (cistrcmp(text1, text2)) THEN
       WRITE(*,*) 'Both strings are equal'
    ELSE
       WRITE(*,*) 'Both strings are not equal'
    END IF
 END PROGRAM cistrcmpExample

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str1

First string to compare.

character(len=*), intent(in) :: str2

Second string to compare

Return Value logical

True if both strings are equal independently of the case. False otherwise.


Contents