Convert a string into a double.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
character(kind=CK,len=*), | intent(in) | :: | str |
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 string_to_dble(json,str) result(rval)
implicit none
class(json_core),intent(inout) :: json
character(kind=CK,len=*),intent(in) :: str
real(RK) :: rval
logical(LK) :: status_ok !! error flag
if (.not. json%exception_thrown) then
call string_to_real(str,rval,status_ok)
if (.not. status_ok) then !if there was an error
rval = 0.0_RK
call json%throw_exception('Error in string_to_dble: '//&
'string cannot be converted to a double: '//&
trim(str))
end if
else
rval = 0.0_RK
end if
end function string_to_dble