Function to turn all upper case characters to lower case.
The resulting string returned has the same length as the input string, and all upper case characters turned into lower case.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*) | :: | string |
string to be converted |
converted string
function upper_to_lower(string) result(result_string) ! --------------------------------------------------------------------------- !> string to be converted character(len=*) :: string !> converted string character(len=len(string)) :: result_string ! --------------------------------------------------------------------------- integer :: mm ! --------------------------------------------------------------------------- result_string='' do mm=1,len_trim(string) if( ('A' <= string(mm:mm)) .and. (string(mm:mm) <= 'Z') ) then result_string(mm:mm) = char(iachar(string(mm:mm))+32) else result_string(mm:mm)=string(mm:mm) end if end do end function upper_to_lower