Reverse a string without using string functions – VBScript

mystr = inputbox(“Enter the String:”)

‘Option 1 – 
Set r=new regexp
 r.pattern =”w|W” ‘ “[a-z 0-9 A-Z]” is equivalent to w
 set s=r.execute(mystr)
For each i in s
 revstr = i.value & revstr
MsgBox “Using regexp :” & vbnewline & revstr

‘Option 2 – 
cnt = Len(mystr)
For i = 1 to cnt
  revstr = Mid(mystr, i, 1) & revstr
Msgbox “Using Mid function: ” & vbnewline & revstr

@Please feel free to comment which will encourage me to write more information in future@

Content posted is based on learning or working experience,
Share the post with others if find useful,
Any queries?, leave comments or discuss on our, Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *