! This file: http://ftp.aset.psu.edu/pub/ger/fortran/hdk/ucaseRM.f90 ! !-- 29 Apr 92, Richard Maine: Version 1.0. module fdas_string !-- string.f90 !-- All character case stuff applies only to U.S. characters. !-- National ASCII characters are treated as non-alphabetic. integer :: i_do integer, parameter :: up_map_ascii(0:127) = & (/ (i_do, i_do=0,96), (i_do-32, i_do=97,122), (i_do, i_do=123,127) /) contains function upper_case (string) result(result) !-- Change all lower case characters in a string to upper case. !-- generic version. !-- System-dependent versions might be more efficient. !-- 29 Apr 92, Richard Maine. !-------------------- interface. character*(*), intent(in) :: string !-- An arbitrary string. character*(len(string)) :: result !-- The converted string. !-------------------- local. integer :: i !-------------------- executable code. do i = 1 , len(string) result(i:i) = achar(up_map_ascii(iachar(string(i:i)))) end do return end function upper_case end module fdas_string program testfdas use fdas_string character (10) string string = "abcdefghij" print *, upper_case(string) end program testfdas