isprint(3f) - [M_strings:COMPARE] returns .true. if character is an
ASCII printable character
(LICENSE:PD)
elemental function isprint(onechar)
character,intent(in) :: onechar
logical :: isprint
isprint(3f) returns .true. if character is an ASCII printable character
onechar character to test
isprint logical value returns true if character is a
printable ASCII character else false.
Sample Program:
program demo_isprint
use M_strings, only : isprint
implicit none
integer :: i
character(len=1),parameter :: string(*)=[(char(i),i=0,127)]
write(*,'(40(a))')'ISPRINT: ',pack( string, isprint(string) )
end program demo_isprint
Results:
ISPRINT: !"#$%&'()*+,-./0123456789:;<=>?@ABCDEF
GHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmn
opqrstuvwxyz{|}~
John S. Urban
Public Domain
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character, | intent(in) | :: | onechar |
elemental function isprint(onechar)
! ident_65="@(#) M_strings isprint(3f) indicates if input character is a printable ASCII character"
character,intent(in) :: onechar
logical :: isprint
select case (onechar)
case (' ':'~') ; isprint=.TRUE.
case default ; isprint=.FALSE.
end select
end function isprint