[UP]


Manual Reference Pages  - anyinteger_to_string (3)

NAME

anyinteger_to_string(3f) - [M_anything] convert integer of any kind to a string (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Results
Example
Author
License

SYNOPSIS

impure function anyinteger_to_string(intin) result(str)

    character(len=:),allocatable :: anyinteger_to_string
    class(*),intent(in)          :: intin

DESCRIPTION

Converts an integer value to a string representing the value. This function allows arguments of different INTEGER types as input.

OPTIONS

VALUEIN
  INTEGER input argument to be converted to a string. May be of KIND kind=int8, kind=int16, kind=int32, kind=int64.

RESULTS

The value of VALUIN converted to a CHARACTER string.

EXAMPLE

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_string

Results:

   127=> 127
   32767=> 32767
   2147483647=> 2147483647
   9223372036854775807=> 9223372036854775807
   -9223372036854775806=> -9223372036854775806

AUTHOR

John S. Urban

LICENSE

Public Domain


anyinteger_to_string (3) October 17, 2020
Generated by manServer 1.08 from 1e389196-a74a-4700-80f2-c35d16faf05c using man macros.