to_real_R4P Function

private elemental function to_real_R4P(self, kind) result(to_number)

Arguments

Type IntentOptional AttributesName
class(string), intent(in) :: self

The string.

real(kind=R4P), intent(in) :: kind

Mold parameter for kind detection.

Return Value real(kind=R4P)

The number into the string.

Description

Cast string to real (R4P).


Source Code

  elemental function to_real_R4P(self, kind) result(to_number)
  !---------------------------------------------------------------------------------------------------------------------------------
  !< Cast string to real (R4P).
  !---------------------------------------------------------------------------------------------------------------------------------
  class(string), intent(in) :: self      !< The string.
  real(R4P),     intent(in) :: kind      !< Mold parameter for kind detection.
  real(R4P)                 :: to_number !< The number into the string.
  !---------------------------------------------------------------------------------------------------------------------------------

  !---------------------------------------------------------------------------------------------------------------------------------
  if (allocated(self%raw)) then
    if (self%is_real()) read(self%raw, *) to_number
  endif
  return
  !---------------------------------------------------------------------------------------------------------------------------------
  endfunction to_real_R4P