isalpha(3f) - [M_strings:COMPARE] returns .true. if character is a
letter and .false. otherwise
(LICENSE:PD)
elemental function isalpha(onechar)
character,intent(in) :: onechar
logical :: isalpha
isalpha(3f) returns .true. if character is a letter and
.false. otherwise
onechar character to test
isalpha logical value returns .true. if character is a ASCII letter
or false otherwise.
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
John S. Urban
Public Domain
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character, | intent(in) | :: | ch |
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