Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | lstring | |||
integer, | intent(in) | :: | strloc | |||
integer, | intent(in) | :: | increment |
integer function findblank( lstring, strloc, increment ) !--------------------------------------------------------------------------- ! This function searches for the address of the closest blank space to a ! specified address in the string. The parameter increment determines if ! the search proceedes foward (+1) or backward (-1). !--------------------------------------------------------------------------- ! arguments character(len=*), intent(in) :: lstring integer, intent(in) :: strloc integer, intent(in) :: increment ! local variables integer :: k, len_string ! initialize variables findblank = 0 len_string = len( trim(adjustL(lstring)) ) !--------------------------------------------------------------------------- k = strloc do while( ( k + increment >= 1 ).and.( k + increment <= len_string) ) k = k + increment if(lstring(k:k) == ' ') then findblank = k return endif end do ! while return !--------------------------------------------------------------------------- end function findblank