name_strings_equal Function

private function name_strings_equal(json, name1, name2) result(is_equal)

Returns true if the name strings name1 is equal to name2, using the specified settings for case sensitivity and trailing whitespace.

Arguments

TypeIntentOptionalAttributesName
class(json_core), intent(inout) :: json
character(kind=CK,len=*), intent(in) :: name1

the name to check

character(kind=CK,len=*), intent(in) :: name2

the name to check

Return Value logical(kind=LK)

true if the string are lexically equal


Calls

proc~~name_strings_equal~~CallsGraph proc~name_strings_equal name_strings_equal proc~lowercase_string lowercase_string proc~name_strings_equal->proc~lowercase_string

Contents

Source Code


Source Code

    function name_strings_equal(json,name1,name2) result(is_equal)

    implicit none

    class(json_core),intent(inout)      :: json
    character(kind=CK,len=*),intent(in) :: name1     !! the name to check
    character(kind=CK,len=*),intent(in) :: name2     !! the name to check
    logical(LK)                         :: is_equal  !! true if the string are
                                                     !! lexically equal

    !must be the same length if we are treating
    !trailing spaces as significant, so do a
    !quick test of this first:
    if (json%trailing_spaces_significant) then
        is_equal = len(name1) == len(name2)
        if (.not. is_equal) return
    end if

    if (json%case_sensitive_keys) then
        is_equal = name1 == name2
    else
        is_equal = lowercase_string(name1) == lowercase_string(name2)
    end if

    end function name_strings_equal