reverse Function

public pure function reverse(string) result(reverse_string)

Reverse the character order in the input character variable (Specification)

Version: experimental

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: string

Return Value character(len=len(string))


Contents

Source Code


Variables

TypeVisibility AttributesNameInitial
integer, public :: i
integer, public :: n

Source Code

    pure function reverse(string) result(reverse_string)
        character(len=*), intent(in) :: string
        character(len=len(string)) :: reverse_string
        integer :: i, n

        n = len(string)
        do i = 1, n
            reverse_string(n-i+1:n-i+1) = string(i:i)
        end do

    end function reverse