Question: How to reverse string

October 11 2012 Cody 10

0

I need to write a recursive method to reverse a string.

The hint given is to convert the string inputed to a character sequence, then apply recursive method, then reverse character sequence, then convert back to  string and output it.

So "abcd" gives output "dcba"

 

I came up with what is below, but I don't know if that's a recursive method.

 

>with(StringTools):

>Reverse("abcd")

        "dcba"

>Reverse(Reverse("abcd"))

         "abcd"

Please Wait...