string_to_dble Function

private function string_to_dble(json, str) result(rval)

Convert a string into a real(RK) value.

Type Bound

json_core

Arguments

Type IntentOptional Attributes Name
class(json_core), intent(inout) :: json
character(kind=CK, len=*), intent(in) :: str

a string

Return Value real(kind=RK)

str converted to a real(RK)


Calls

proc~~string_to_dble~~CallsGraph proc~string_to_dble json_value_module::json_core%string_to_dble none~throw_exception json_value_module::json_core%throw_exception proc~string_to_dble->none~throw_exception proc~string_to_real json_string_utilities::string_to_real proc~string_to_dble->proc~string_to_real proc~json_throw_exception json_value_module::json_core%json_throw_exception none~throw_exception->proc~json_throw_exception

Called by

proc~~string_to_dble~~CalledByGraph proc~string_to_dble json_value_module::json_core%string_to_dble proc~parse_number json_value_module::json_core%parse_number proc~parse_number->proc~string_to_dble proc~parse_value json_value_module::json_core%parse_value proc~parse_value->proc~parse_number proc~parse_array json_value_module::json_core%parse_array proc~parse_value->proc~parse_array proc~parse_object json_value_module::json_core%parse_object proc~parse_value->proc~parse_object proc~json_parse_file json_value_module::json_core%json_parse_file proc~json_parse_file->proc~parse_value proc~json_parse_string json_value_module::json_core%json_parse_string proc~json_parse_string->proc~parse_value proc~parse_array->proc~parse_value proc~parse_object->proc~parse_value proc~parse_object->proc~parse_object none~deserialize json_value_module::json_core%deserialize none~deserialize->proc~json_parse_string none~load json_value_module::json_core%load none~load->proc~json_parse_file proc~json_file_load json_file_module::json_file%json_file_load proc~json_file_load->none~load proc~json_file_load_from_string json_file_module::json_file%json_file_load_from_string proc~json_file_load_from_string->none~deserialize proc~wrap_json_parse_string json_value_module::wrap_json_parse_string proc~wrap_json_parse_string->none~deserialize none~deserialize~2 json_file_module::json_file%deserialize none~deserialize~2->proc~json_file_load_from_string proc~assign_string_to_json_file json_file_module::json_file%assign_string_to_json_file proc~assign_string_to_json_file->none~deserialize~2 proc~initialize_json_file_from_string json_file_module::initialize_json_file_from_string proc~initialize_json_file_from_string->none~deserialize~2 proc~initialize_json_file_from_string_v2 json_file_module::initialize_json_file_from_string_v2 proc~initialize_json_file_from_string_v2->none~deserialize~2 proc~wrap_json_file_load_from_string json_file_module::wrap_json_file_load_from_string proc~wrap_json_file_load_from_string->none~deserialize~2 interface~json_file json_file_module::json_file interface~json_file->proc~initialize_json_file_from_string interface~json_file->proc~initialize_json_file_from_string_v2 proc~wrap_assign_string_to_json_file json_file_module::wrap_assign_string_to_json_file proc~wrap_assign_string_to_json_file->proc~assign_string_to_json_file proc~wrap_initialize_json_file_from_string json_file_module::wrap_initialize_json_file_from_string proc~wrap_initialize_json_file_from_string->proc~initialize_json_file_from_string proc~wrap_initialize_json_file_from_string_v2 json_file_module::wrap_initialize_json_file_from_string_v2 proc~wrap_initialize_json_file_from_string_v2->proc~initialize_json_file_from_string_v2

Source Code

    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