Reversing a String with VBScript… the easy way!
Posted by: Jerry Lees
In a previous post, entitled Reversing a string with VBScript using the mid function, I shared a piece of code with you that reversed a string. It was simple and effective… but it’s not the piece of code I ended up using in my encryption code.
I found a much easier function built right into VBScript! The StrReverse function! It’s quite simple to use… pass it a string and it returns back to you a reversed version of that string. Here is the code I posted earlier– only using the StrReverse function:
Option Explicit
Dim MyStr, char, NewStr, x, y
MyStr = “Reverse Me!”
NewStr = StrReverse(MyStr)
WScript.Echo NewStr



You must be logged-in to post a comment. Log-in/Register