isspace Function

public elemental function isspace(ch) result(res)

NAME

 isspace(3f) - [M_strings:COMPARE] returns .true. if character is a
 null, space, tab, carriage return, new line, vertical tab, or formfeed
 (LICENSE:PD)

SYNOPSIS

elemental function isspace(onechar)

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

DESCRIPTION

 isspace(3f) returns .true. if character is a null, space, tab,
 carriage return, new line, vertical tab, or formfeed

OPTIONS

onechar  character to test

RETURNS

isspace  returns true if character is ASCII white space

EXAMPLE

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

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