Sunday, November 22, 2009

VBScript for Reversing String

Option Explicit

Dim
val(),temp,tt,inp,i,j


temp=inputbox("Enter the Size of an Text to reverse")

For i=0 to temp-1


redim preserve val(i)

inp=
inputbox("Enter" & i & "th Value in to Array")
val(i)=inp

'temp=temp+1


Next

tt=""

For j=ubound(val) to lbound(val) step-1


tt=tt&val(j)
'print tt


Next

print "Reversed String of your given String" & tt



Thanks & Regards
Baba Fakruddin.D

1 comment:

suman Ch said...

Str = "Reverse"
Cnt = Len(Str)
RStr = ""
For i = 1 to Cnt
RStr = Mid(Str,i,1) & RStr
Next
Msgbox RStr

Even this will reverse a string

There was an error in this gadget