isxdigit Function

public elemental function isxdigit(ch) result(res)

NAME

 isxdigit(3f) - [M_strings:COMPARE] returns .true. if character is a
 hexadecimal digit (0-9, a-f, or A-F).
 (LICENSE:PD)

SYNOPSIS

elemental function isxdigit(onechar)

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

DESCRIPTION

 isxdigit(3f) returns .true. if character is a hexadecimal digit (0-9,
 a-f, or A-F).

OPTIONS

onechar   character to test

RETURNS

isxdigit  logical value returns true if character is a hexadecimal digit

EXAMPLE

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

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 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