[UP]


Manual Reference Pages  - isdigit (3)

NAME

isdigit(3f) - [M_strings:COMPARE] returns .true. if character is a digit (0,1,...,9) and .false. otherwise (LICENSE:PD)

CONTENTS

Synopsis
Description
Examples
Author
License

SYNOPSIS

elemental function isdigit(onechar)

    character,intent(in) :: onechar
    logical              :: isdigit

DESCRIPTION

isdigit(3f) returns .true. if character is a digit (0,1,...,9) and .false. otherwise

EXAMPLES

Sample Program:

    program demo_isdigit
    use M_strings, only : isdigit, isspace, switch
    implicit none
    character(len=10),allocatable :: string(:)
    integer                       :: i
       string=[&
       & ’1 2 3 4 5 ’ ,&
       & ’letters   ’ ,&
       & ’1234567890’ ,&
       & ’both 8787 ’ ]
       ! if string is nothing but digits and whitespace return .true.
       do i=1,size(string)
          write(*,’(a)’,advance=’no’)’For string[’//string(i)//’]’
          write(*,*) &
           & all(isdigit(switch(string(i))).or.&
           & isspace(switch(string(i))))
       enddo
    end program demo_isdigit

Expected output:

       For string[1 2 3 4 5 ] T
       For string[letters   ] F
       For string[1234567890] T
       For string[both 8787 ] F

AUTHOR

John S. Urban

LICENSE

Public Domain


isdigit (3) March 11, 2021
Generated by manServer 1.08 from 29b73433-22db-41dd-b5af-6e8747117414 using man macros.