Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | inString |
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 GetUnitSubString(inString) RESULT (outUnit)
! SUBROUTINE INFORMATION:
! AUTHOR Jason Glazer
! DATE WRITTEN February 2013
! MODIFIED na
! RE-ENGINEERED na
! PURPOSE OF THIS SUBROUTINE:
! return the substring contained in brackets []
! that contains the units.
! METHODOLOGY EMPLOYED:
! na
IMPLICIT NONE
! SUBROUTINE ARGUMENT DEFINITIONS:
CHARACTER(len=*), INTENT(IN) :: inString ! Input String
CHARACTER(len=LEN(inString)) :: outUnit ! Result String
! SUBROUTINE PARAMETER DEFINITIONS:
! na
! INTERFACE BLOCK SPECIFICATIONS:
! na
! DERIVED TYPE DEFINITIONS:
! na
! SUBROUTINE LOCAL VARIABLE DECLARATIONS:
INTEGER :: posLBrac
INTEGER :: posRBrac
outUnit = " "
!check if string has brackets or parentheses
posLBrac = INDEX(inString, '[') ! left bracket
posRBrac = INDEX(inString, ']') ! right bracket
!extract the substring with the units
IF ((posLBrac .GT. 0) .AND. (posRBrac .GT. 0) .AND. ((posRBrac - posLBrac) .GE. 2)) THEN
outUnit = inString(posLBrac+1:posRBrac-1)
ELSE
outUnit = " "
END IF
END FUNCTION GetUnitSubString