Reverse a string without using strReverse or Mid Function

Welcome to

Recently one of my colleagues put an interesting situation to script in vbs. It was to reverse a string without using Mid or string Reverse function. For example, if the given string is – AUTOMATED 360 , the result should be DETAMOTUA 063.

Since most of us are likely to use the built in functions and not to think about other ways of doing the same, it sounds like a bit tough. I also had the same situation, but a few minutes of analysis resulted me the solution for the same. The trick is to put all the characters in array and then print the array in reverse order.

below is the code using array to reverse the string.

Here is one more nice way to do this using array again.


  1. Hello Saket,

    Nice code for reverse string, I have faced this question in most of interviews.

    Can I have function for generating the qtp results with screen shots in a PDF or word formate please?

    Thanks in advance.



  2. Sub abc()

    srt = “Automation is good”
    Count = Split(srt, ” “)
    ‘MsgBox UBound(Count)
    For a = 0 To UBound(Count)
    For i = 1 To Len(Count(a))
    temp1 = temp1 & Left(Right(Count(a), i), 1)


    temp2 = temp2 & ” ” & temp1

    temp1 = “”

    MsgBox temp2
    End Sub


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.