Returns true if the name strings name1
is equal to name2
, using
the specified settings for case sensitivity and trailing whitespace.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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 |
true if the string are lexically equal
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