By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,944 Members | 722 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,944 IT Pros & Developers. It's quick & easy.

Reversing characters in a string

P: 9
Private Sub displayButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles displayButton.Click
' creates and displays a new password

Dim origPassword As String
Dim newPassword As String = String.Empty
Dim indexNum As Integer

' assign input to a variable (the origPasswordTextBox's CharacterCasing
' property is set to Upper)
origPassword = origPasswordTextBox.Text

' verify that the password contains 5, 6, or 7 characters
If origPassword.Length >= 5 AndAlso origPassword.Length <= 7 Then
' replace all vowels (A, E, I, O, and U) with an X
origPassword = origPassword.Replace("A", "X")
origPassword = origPassword.Replace("E", "X")
origPassword = origPassword.Replace("I", "X")
origPassword = origPassword.Replace("O", "X")
origPassword = origPassword.Replace("U", "X")

' replace all numbers with a Z
origPassword = origPassword.Replace("0", "Z")
origPassword = origPassword.Replace("1", "Z")
origPassword = origPassword.Replace("2", "Z")
origPassword = origPassword.Replace("3", "Z")
origPassword = origPassword.Replace("4", "Z")
origPassword = origPassword.Replace("5", "Z")
origPassword = origPassword.Replace("6", "Z")
origPassword = origPassword.Replace("7", "Z")
origPassword = origPassword.Replace("8", "Z")
origPassword = origPassword.Replace("9", "Z")

' reverse the characters in the password

' display the new password
newPasswordLabel.Text = newPassword

Else ' processed when the password is not the correct length
newPasswordLabel.Text = ""
MessageBox.Show("Please enter 5, 6, or 7 characters.", "Password", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
End If


Hey is there a function that allows you to reverse characters if so what is it
Mar 29 '07 #1
Share this Question
Share on Google+
3 Replies

Expert 100+
P: 1,017
[PHP]StrReverse("yor string here")[/PHP]
Mar 29 '07 #2

P: 9
[PHP]StrReverse("yor string here")[/PHP]

Thank you so much. I really appreciate it
Mar 29 '07 #3

Expert 5K+
P: 8,127
Simply try String.Reverse it will work
Mar 29 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.