The VBScript Network and Systems Administrator's Cafe

Nov 28 2008   5:07PM GMT

Reversing a String with VBScript… the easy way!

Jerry Lees Jerry Lees Profile: 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

1  Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • sachadee
    WScript.Echo StrReverse("Reverse-Me")

    Is enough !
    10 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: