Tuesday, May 1, 2012
Name Backwards
I made this one far too complicated.
I tried to split up the program to do the first name and last name separately. I also had the characters picked out one by one and... things just got really messy.
The new and improved code:
Dim origName As String = Me.txtName.Text
Dim lengthName As Double = origName.Length
Dim backName As String = Nothing
Dim currentLetter As String
For count As Integer = (lengthName - 1) To 0 Step -1
currentLetter = origName.Chars(count)
backName = String.Concat(backName, currentLetter)
Next count
Me.lblBackwards.Text = backName
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment