stdlib_str2num#
See also the specification page: stdlib_str2num.
stdlib_str2num (module)#
The stdlib_str2num module provides procedures and interfaces for converting character data to numerical types. Currently supported: integer and real. (Specification: stdlib_str2num)
This code was adapted from jalvesz/Fortran-String-to-Num and related design discussion at https://fortran-lang.discourse.group/t/faster-string-to-double/.
Interfaces
to_num (interface)#
to_num_from_stream (interface)#
-
to_num_from_stream (interface) Conversion of a stream of values in a string to numbers (Specification: stdlib_str2num)
to_num_base (interface)#
-
to_num_base (interface)
Procedures
to_int8 (function)#
-
elemental function to_int8(s, mold) -> v - Arguments:
- scharacter(len=*), intent(in)
input string
- moldinteger(kind=int8), intent(in)
dummy argument to disambiguate at compile time the generic interface
- Returns:
- vinteger(kind=int8)
Output integer(int8) value
to_int8_from_stream (function)#
-
function to_int8_from_stream(s, mold, stat) -> v - Arguments:
- scharacter(len=:), pointer
input string
- moldinteger(kind=int8), intent(in)
dummy argument to disambiguate at compile time the generic interface
- statinteger(kind=int8), intent(inout), optional
- Returns:
- vinteger(kind=int8)
Output integer(int8) value
to_int16 (function)#
-
elemental function to_int16(s, mold) -> v - Arguments:
- scharacter(len=*), intent(in)
input string
- moldinteger(kind=int16), intent(in)
dummy argument to disambiguate at compile time the generic interface
- Returns:
- vinteger(kind=int16)
Output integer(int16) value
to_int16_from_stream (function)#
-
function to_int16_from_stream(s, mold, stat) -> v - Arguments:
- scharacter(len=:), pointer
input string
- moldinteger(kind=int16), intent(in)
dummy argument to disambiguate at compile time the generic interface
- statinteger(kind=int8), intent(inout), optional
- Returns:
- vinteger(kind=int16)
Output integer(int16) value
to_int32 (function)#
-
elemental function to_int32(s, mold) -> v - Arguments:
- scharacter(len=*), intent(in)
input string
- moldinteger(kind=int32), intent(in)
dummy argument to disambiguate at compile time the generic interface
- Returns:
- vinteger(kind=int32)
Output integer(int32) value
to_int32_from_stream (function)#
-
function to_int32_from_stream(s, mold, stat) -> v - Arguments:
- scharacter(len=:), pointer
input string
- moldinteger(kind=int32), intent(in)
dummy argument to disambiguate at compile time the generic interface
- statinteger(kind=int8), intent(inout), optional
- Returns:
- vinteger(kind=int32)
Output integer(int32) value
to_int64 (function)#
-
elemental function to_int64(s, mold) -> v - Arguments:
- scharacter(len=*), intent(in)
input string
- moldinteger(kind=int64), intent(in)
dummy argument to disambiguate at compile time the generic interface
- Returns:
- vinteger(kind=int64)
Output integer(int64) value
to_int64_from_stream (function)#
-
function to_int64_from_stream(s, mold, stat) -> v - Arguments:
- scharacter(len=:), pointer
input string
- moldinteger(kind=int64), intent(in)
dummy argument to disambiguate at compile time the generic interface
- statinteger(kind=int8), intent(inout), optional
- Returns:
- vinteger(kind=int64)
Output integer(int64) value
to_sp (function)#
-
elemental function to_sp(s, mold) -> v - Arguments:
- scharacter(len=*), intent(in)
input string
- moldreal(kind=sp), intent(in)
dummy argument to disambiguate at compile time the generic interface
- Returns:
- vreal(kind=sp)
Output real(sp) value
to_sp_from_stream (function)#
-
function to_sp_from_stream(s, mold, stat) -> v - Arguments:
- scharacter(len=:), pointer
input string
- moldreal(kind=sp), intent(in)
dummy argument to disambiguate at compile time the generic interface
- statinteger(kind=int8), intent(inout), optional
- Returns:
- vreal(kind=sp)
Output real(sp) value
to_dp (function)#
-
elemental function to_dp(s, mold) -> v - Arguments:
- scharacter(len=*), intent(in)
input string
- moldreal(kind=dp), intent(in)
dummy argument to disambiguate at compile time the generic interface
- Returns:
- vreal(kind=dp)
Output real(dp) value
to_dp_from_stream (function)#
-
function to_dp_from_stream(s, mold, stat) -> v - Arguments:
- scharacter(len=:), pointer
input string
- moldreal(kind=dp), intent(in)
dummy argument to disambiguate at compile time the generic interface
- statinteger(kind=int8), intent(inout), optional
- Returns:
- vreal(kind=dp)
Output real(dp) value
to_int8_base (subroutine)#
-
elemental subroutine to_int8_base(s, v, p, stat) Return an int8 integer
initialize error status with any number > 0
Indicates integer overflow
- Arguments:
- scharacter(len=*), intent(in)
input string
- vinteger(kind=int8), intent(out)
Output real value
- pinteger(kind=int8), intent(out)
position within the number
- statinteger(kind=int8), intent(out)
status upon succes or failure to read
to_int16_base (subroutine)#
-
elemental subroutine to_int16_base(s, v, p, stat) Return an int16 integer
initialize error status with any number > 0
Indicates integer overflow
- Arguments:
- scharacter(len=*), intent(in)
input string
- vinteger(kind=int16), intent(out)
Output real value
- pinteger(kind=int8), intent(out)
position within the number
- statinteger(kind=int8), intent(out)
status upon succes or failure to read
to_int32_base (subroutine)#
-
elemental subroutine to_int32_base(s, v, p, stat) Return an int32 integer
initialize error status with any number > 0
Indicates integer overflow
- Arguments:
- scharacter(len=*), intent(in)
input string
- vinteger(kind=int32), intent(out)
Output real value
- pinteger(kind=int8), intent(out)
position within the number
- statinteger(kind=int8), intent(out)
status upon succes or failure to read
to_int64_base (subroutine)#
-
elemental subroutine to_int64_base(s, v, p, stat) Return an int64 integer
initialize error status with any number > 0
Indicates integer overflow
- Arguments:
- scharacter(len=*), intent(in)
input string
- vinteger(kind=int64), intent(out)
Output real value
- pinteger(kind=int8), intent(out)
position within the number
- statinteger(kind=int8), intent(out)
status upon succes or failure to read
to_sp_base (subroutine)#
-
elemental subroutine to_sp_base(s, v, p, stat) initialize error status with any number > 0
- Arguments:
- scharacter(len=*), intent(in)
input string
- vreal(kind=wp), intent(inout)
Output real value
- pinteger(kind=int8), intent(out)
last position within the string
- statinteger(kind=int8), intent(out)
status upon success or failure to read
to_dp_base (subroutine)#
-
elemental subroutine to_dp_base(s, v, p, stat) initialize error status with any number > 0
- Arguments:
- scharacter(len=*), intent(in)
input string
- vreal(kind=wp), intent(inout)
Output real value
- pinteger(kind=int8), intent(out)
last position within the string
- statinteger(kind=int8), intent(out)
status upon success or failure to read