|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 12/15/2008 10:13:02 PM
Posts: 2,
Visits: 2
|
|
| Im taking a programing essentials class, and was hoping someone could help me. Its programing essentials 1, so it should be pretty easy to most people with this. Its one of the projects in the Microsoft Visual basic 05 book. Ill explain it. So i would enter the text Benjamin Franklin(or any other text) and then once i click a button it would be displayd backwords(nilknarf nimajneb). Ive been doing fine till i came up to this part. Thank you to anyone that helps me out
|
|
|
|
|
Admin
      
Group: Administrators
Last Login: 10/13/2010 9:32:56 AM
Posts: 165,
Visits: 333
|
|
You could use something like this, using the length of the input string to loop through each character and reverse it:
Dim stringLength As Long, Counter As Long
Dim singleChar As String
Dim reverseString As String
stringLength = Len(InputString)
For Counter = stringLength To 1 Step -1
singleChar = Mid(InputString, Counter, 1)
reverseString = reverseString & singleChar
Next
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 12/15/2008 10:13:02 PM
Posts: 2,
Visits: 2
|
|
| That is exactly what i needed. I was not sure how to do the letter positions and what kind of loop i needed. Thank you.
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 4/4/2009 10:07:48 AM
Posts: 3,
Visits: 7
|
|
but I think there is a function from VB that more efficient..
example :
dim a as string
a="abc"
a=StrReverse(a)
print a
CMIIW.. (Correct Me If I Wrong)
hehehe..
|
|
|
|
|
Forum Newbie
      
Group: Forum Members
Last Login: 6/11/2009 12:06:27 PM
Posts: 3,
Visits: 4
|
|
| StrReverse() is indeed a function that returns a string in reverse order. Private Sub Form_Load() Dim strMyString As String strMyString = "Hello" MsgBox StrReverse(strMyString) End Sub
Sour grapes can make sweet wine.
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 1/11/2010 9:48:55 AM
Posts: 14,
Visits: 15
|
|
what is that?????
ehm, yes....
,,,,
(( . . ))
(( ))
(,,) (,,)
|
|
|
|
|
Forum Newbie
      
Group: Banned Members
Last Login: 5/28/2009 6:51:46 PM
Posts: 8,
Visits: 2
|
|
| cant you just type it backwards
|
|
|
|
|
Forum Newbie
      
Group: Banned Members
Last Login: 5/28/2009 6:51:46 PM
Posts: 8,
Visits: 2
|
|
| lol sry idk what you mean
|
|
|
|
|
Junior Member
      
Group: Forum Members
Last Login: 12/26/2010 8:36:23 AM
Posts: 11,
Visits: 2
|
|
Can anybody post an output of this?
In a world without walls, who needs Windows?
|
|
|
|