Manual Reference Pages  - int (3m_strings)

NAME

int(3f) - [M_strings:TYPE] overloads INT(3f) so it can handle character arguments (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Returns
Examples
Author
License

SYNOPSIS

impure elemental function int(string)

    character(len=*) :: string
    integer(kind=int32) :: int

DESCRIPTION

int(3f) returns an integer when given a numeric representation of a numeric value. This overloads the INT(3f) intrinsic so that CHARACTER arguments assumed to represent a numeric value may be input.

OPTIONS

STRING input string to be converted to an INT32 integer

RETURNS

INT integer represented by input string

EXAMPLES

Sample program:

     program demo_int
     use,intrinsic :: iso_fortran_env, only : int8, int16, int32, int64
     use M_strings, only: int
     implicit none
     character(len=*),parameter :: g=’(*(g0,1x))’
        write(*,g)int(’100’),int(’20.4’)
        write(*,g)’intrinsic int(3f) still works’,int(20,int32)
        write(*,g)’elemental’,&
        & int([character(len=23) :: ’10’,’20.3’,’20.5’,’20.6’])
     end program demo_int

Results:

    > 100 20
    > intrinsic int(3f) still works 20
    > elemental 10 20 20 20

AUTHOR

John S. Urban

LICENSE

Public Domain


Nemo Release 3.1 int (3m_strings) July 20, 2024
Generated by manServer 1.08 from 6a5d5739-e206-4951-a376-3de2fbb76c7a using man macros.