anyinteger_to_string(3f) - [M_anything] convert integer of any kind to a string (LICENSE:MIT)
Synopsis
Description
Options
Results
Examples
Author
License
impure function anyinteger_to_string(intin) result(str)
character(len=:),allocatable :: anyinteger_to_string class(*),intent(in) :: intin
Converts an integer value to a string representing the value. This function allows arguments of different INTEGER types as input.
VALUEIN INTEGER input argument to be converted to a string. May be of KIND kind=int8, kind=int16, kind=int32, kind=int64.
The value of VALUIN converted to a CHARACTER string.
Sample program
program demo_anyinteger_to_string use, intrinsic :: iso_fortran_env, only : int8, int16, int32, int64 use M_anything, only : itoc=>anyinteger_to_string implicit none write(*,*)itoc(huge(0_int8)), => 127 write(*,*)itoc(huge(0_int16)), => 32767 write(*,*)itoc(huge(0_int32)), => 2147483647 write(*,*)itoc(huge(0_int64)), => 9223372036854775807,huge(0_int64) write(*,*)itoc(-(huge(0_int64)-1)), => -9223372036854775806 end program demo_anyinteger_to_stringResults:
127=> 127 32767=> 32767 2147483647=> 2147483647 9223372036854775807=> 9223372036854775807 -9223372036854775806=> -9223372036854775806
John S. Urban
Nemo Release 3.1 | anyinteger_to_string (3) | February 23, 2025 |