Created
March 28, 2010 00:42
-
-
Save natebenes/346463 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INTEGER FUNCTION caseDifference(string) | |
IMPLICIT NONE | |
CHARACTER (LEN=*), INTENT(IN) :: string | |
INTEGER :: stringLength = LEN_TRIM(string) | |
INTEGER :: i, caseDifference | |
INTEGER :: uppercase = 0, lowercase = 0 | |
DO i = 1, stringLength, 1 | |
IF (LLE("a",string(i:i)) .AND. LGE(string(i:i), "z")) THEN | |
! Its lowercase | |
lowercase = lowercase + 1 | |
END IF | |
IF (LLE("A",string(i:i)) .AND. LGE(string(i:i), "Z")) THEN | |
! Its uppercase | |
uppercase = uppercase + 1 | |
END IF | |
END DO | |
caseDifference = ABS(lowercase-uppercase) | |
END FUNCTION caseDifference |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment