Reversing a String with VBScript… the easy way! - The VBScript Network and Systems Administrator's Cafe

The VBScript Network and Systems Administrator's Cafe

Nov 28 2008   5:07PM GMT

Reversing a String with VBScript… the easy way!



Posted by: Jerry Lees
VBScript, String manipulation, StrReverse, Reverse Strings

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

Comment on this Post


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