Manual Reference Pages  - nint (3m_strings)

NAME

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

CONTENTS

Synopsis
Description
Options
Returns
Examples
Author
License

SYNOPSIS

impure elemental function nint(string)

    character(len=*) :: string
    integer          :: nint

DESCRIPTION

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

OPTIONS

STRING input string to be converted to an integer

RETURNS

NINT integer represented by input string

EXAMPLES

Sample program:

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

Results:

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

AUTHOR

John S. Urban

LICENSE

Public Domain


Nemo Release 3.1 nint (3m_strings) July 20, 2024
Generated by manServer 1.08 from f1a70866-b4f2-46bc-a251-84cdf2c6fbe0 using man macros.