iscntrl(3f) - [M_strings:COMPARE] returns .true. if character is a
delete character or ordinary control character
(LICENSE:PD)
elemental function iscntrl(onechar)
character,intent(in) :: onechar
logical :: iscntrl
iscntrl(3f) returns .true. if character is a delete character or
ordinary control character
onechar character to test
iscntrl logical value returns true if character is a control character
Sample program
program demo_iscntrl
use M_strings, only : iscntrl
implicit none
integer :: i
character(len=1),parameter :: string(*)=[(char(i),i=0,127)]
write(*,'(20(g0,1x))')'ISCNTRL: ', &
& iachar(pack( string, iscntrl(string) ))
end program demo_iscntrl
Results:
ISCNTRL: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
20 21 22 23 24 25 26 27 28 29 30 31 127
John S. Urban
Public Domain
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character, | intent(in) | :: | ch |
elemental function iscntrl(ch) result(res)
! ident_73="@(#) M_strings iscntrl(3f) true if a delete or ordinary control character(0x7F or 0x00-0x1F)"
character,intent(in) :: ch
logical :: res
select case(ch)
case(char(127),char(0):char(31))
res=.true.
case default
res=.false.
end select
end function iscntrl