isxdigit(3f) - [M_strings:COMPARE] returns .true. if character is a
hexadecimal digit (0-9, a-f, or A-F).
(LICENSE:PD)
elemental function isxdigit(onechar)
character,intent(in) :: onechar
logical :: isxdigit
isxdigit(3f) returns .true. if character is a hexadecimal digit (0-9,
a-f, or A-F).
onechar character to test
isxdigit logical value returns true if character is a hexadecimal digit
Sample program
program demo_isxdigit
use M_strings, only : isxdigit
implicit none
integer :: i
character(len=1),parameter :: string(*)=[(char(i),i=0,127)]
write(*,'(40(a))')'ISXDIGIT: ',pack( string, isxdigit(string) )
end program demo_isxdigit
Results:
ISXDIGIT: 0123456789ABCDEFabcdef
John S. Urban
Public Domain
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character, | intent(in) | :: | ch |
elemental function isxdigit(ch) result(res)
! ident_68="@(#) M_strings isxdigit(3f) returns .true. if c is a hexadecimal digit (0-9 a-f or A-F)"
character,intent(in) :: ch
logical :: res
select case(ch)
case('A':'F','a':'f','0':'9')
res=.true.
case default
res=.false.
end select
end function isxdigit