isspace(3f) - [M_strings:COMPARE] returns .true. if character is a
null, space, tab, carriage return, new line, vertical tab, or formfeed
(LICENSE:PD)
elemental function isspace(onechar)
character,intent(in) :: onechar
logical :: isspace
isspace(3f) returns .true. if character is a null, space, tab,
carriage return, new line, vertical tab, or formfeed
onechar character to test
isspace returns true if character is ASCII white space
Sample program:
program demo_isspace
use M_strings, only : isspace
implicit none
integer :: i
character(len=1),parameter :: string(*)=[(char(i),i=0,127)]
write(*,'(20(g0,1x))')'ISSPACE: ', &
& iachar(pack( string, isspace(string) ))
end program demo_isspace
Results:
ISSPACE: 0 9 10 11 12 13 32
John S. Urban
Public Domain
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character, | intent(in) | :: | ch |
elemental function isspace(ch) result(res)
! ident_72="@(#) M_strings isspace(3f) true if null space tab return new line vertical tab or formfeed"
character,intent(in) :: ch
logical :: res
select case(ch)
case(' ') ! space(32)
res=.true.
case(char(0)) ! null(0)
res=.true.
case(char(9):char(13)) ! tab(9), new line(10), vertical tab(11), formfeed(12), carriage return(13),
res=.true.
case default
res=.false.
end select
end function isspace