|
-
Jun 27th, 2001, 10:59 AM
#1
Thread Starter
Hyperactive Member
reading a string
Well . I want to read a string character by character . starting from the end ... I did it before .but now i completely forgot how to do it .. can someone post a code that reads a string each character at at time .. and then we cna decrement the pointer to read the preceeding character ..
Tahnx
-
Jun 27th, 2001, 11:05 AM
#2
Frenzied Member
for x = len(yourWord) to 0
msgbox mid(yourWord,x,1)
next x
i'm not sure, but it will problably work,
it's been long since i did some vb!!
with what reeset just say,
if my code does not work, this will
for x = 0 to len(yourWord)
msgbox mid(strReverse(yourWord),x,1)
next x
Last edited by sebs; Jun 27th, 2001 at 11:30 AM.
-
Jun 27th, 2001, 11:26 AM
#3
Hyperactive Member
If you are just working with a string, use the strReverse command. This will reverse the string, and allow you to read it from beginning to end.
VB Code:
Private Sub Command1_Click()
Dim test_string As String
test_string = "Hello World"
test_string = StrReverse(test_string)
MsgBox test_string
End Sub
Hope this helps.
-
Jun 27th, 2001, 11:50 AM
#4
Addicted Member
VB Code:
Private Sub Form_Load()
Dim lIndex As Long
Dim sStringToReadIn As String
sStringToReadIn = "Hello World"
For lIndex = Len(sStringToReadIn) To 1 Step -1
If lIndex = 0 Then
Exit For
End If
Text1 = Text1 & Mid$(sStringToReadIn, lIndex, 1) & " - " & lIndex & vbCrLf
Next
End Sub
poooof
Wizard Since 1997    
SQL Server 7.0:2K, Oracle, VB 6.0 EE, VBScript, C/C++, COBOL, RPG ILE, HTML, XML, Perl
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|