Returns true if name
is equal to p%name
, using the specified
settings for case sensitivity and trailing whitespace.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
type(json_value), | intent(in) | :: | p | the json object |
||
character(kind=CK,len=*), | intent(in) | :: | name | the name to check for |
true if the string are lexically equal
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
function name_equal(json,p,name) result(is_equal)
implicit none
class(json_core),intent(inout) :: json
type(json_value),intent(in) :: p !! the json object
character(kind=CK,len=*),intent(in) :: name !! the name to check for
logical(LK) :: is_equal !! true if the string are lexically equal
if (allocated(p%name)) then
!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(p%name) == len(name)
if (.not. is_equal) return
end if
if (json%case_sensitive_keys) then
is_equal = p%name == name
else
is_equal = lowercase_string(p%name) == lowercase_string(name)
end if
else
is_equal = name == '' ! check a blank name
end if
end function name_equal