Convert a string into a real(RK)
value.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(json_core), | intent(inout) | :: | json | |||
character(kind=CK, len=*), | intent(in) | :: | str |
a string |
str
converted to a real(RK)
function string_to_dble(json,str) result(rval) implicit none class(json_core),intent(inout) :: json character(kind=CK,len=*),intent(in) :: str !! a string real(RK) :: rval !! `str` converted to a `real(RK)` logical(LK) :: status_ok !! error flag for [[string_to_real]] call string_to_real(str,json%use_quiet_nan,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 real: '//& trim(str)) end if end function string_to_dble