Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | inString | |||
integer, | intent(in) | :: | colNum |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module. Where possible, edges connecting nodes are given different colours to make them easier to distinguish in large graphs.
FUNCTION GetColumnUsingTabs(inString,colNum) RESULT (resultString)
! SUBROUTINE INFORMATION:
! AUTHOR Jason Glazer
! DATE WRITTEN March 2008
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! Assumes that the input string contains tabs that mark the
! separation between columns. Returns the string that appears
! in the column specified.
! METHODOLOGY EMPLOYED:
! na
IMPLICIT NONE
! SUBROUTINE ARGUMENT DEFINITIONS:
CHARACTER(len=*), INTENT(IN) :: inString ! Input String
INTEGER, INTENT(IN) :: colNum ! Column number
CHARACTER(len=LEN(inString)) :: resultString ! Result String
! SUBROUTINE PARAMETER DEFINITIONS:
CHARACTER(1),PARAMETER :: tb=CHAR(9) !tab character
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
CHARACTER(len=LEN(inString)) :: procIn ! processed input string
INTEGER :: startTab
INTEGER :: endTab
INTEGER :: inLen
INTEGER :: i
procIn = inString
inLen = LEN(procIn)
startTab = 0
endTab = INDEX(procIn,tb)
IF (endTab .GT. 0) THEN
procIn(endTab:endTab) = ' ' !replace tab with space so next search doesn't find this tab again
ELSE
endTab = inLen + 1 !one character past the end of string since substract one when extracting
END IF
DO i = 2,colNum !already have first column identified so do loop only if for column 2 or greater.
startTab = endTab
endTab = INDEX(procIn,tb)
IF (endTab .GT. 0) THEN
procIn(endTab:endTab) = ' ' !replace tab with space so next search doesn't find this tab again
ELSE
endTab = inLen + 1 !one character past the end of string since substract one when extracting
END IF
END DO
IF (startTab .LT. endTab) THEN
resultString = procIn(startTab+1:endTab-1) !extract but leave tab characters out
ELSE
resultString = ''
END IF
END FUNCTION GetColumnUsingTabs