isalpha Function

public elemental function isalpha(ch) result(res)

NAME

isalpha(3f) - [M_strings:COMPARE] returns .true. if character is a
letter and .false. otherwise
(LICENSE:PD)

SYNOPSIS

elemental function isalpha(onechar)

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

DESCRIPTION

isalpha(3f) returns .true. if character is a letter and
.false. otherwise

OPTIONS

onechar  character to test

RETURNS

isalpha  logical value returns .true. if character is a ASCII letter
         or false otherwise.

EXAMPLE

Sample program

 program demo_isalpha
 use M_strings, only : isalpha
 implicit none
 integer                    :: i
 character(len=1),parameter :: string(*)=[(char(i),i=0,127)]
    write(*,'(40(a))')'ISGRAPH: ',pack( string, isalpha(string) )
 end program demo_isalpha

Results:

ISGRAPH: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklm
nopqrstuvwxyz

AUTHOR

John S. Urban

LICENSE

Public Domain

Arguments

Type IntentOptional Attributes Name
character, intent(in) :: ch

Return Value logical


Contents

Source Code


Source Code

elemental function isalpha(ch) result(res)

! ident_67="@(#) M_strings isalpha(3f) Return .true. if character is a letter and .false. otherwise"

character,intent(in) :: ch
logical              :: res
   select case(ch)
   case('A':'Z','a':'z')
     res=.true.
   case default
     res=.false.
   end select
end function isalpha