|
-
Nov 25th, 2000, 01:52 AM
#1
Thread Starter
Hyperactive Member
Hi, i have a string of 150 characters
I need to process each character 1 by 1..
And *ONLY* the 150 from the string..
so if there are 151 in the string.. then DON'T process any above 150
i need to process each character 1 by 1.. so its like
the character can be A-Z, 1-9, or any character that is like ®©žó.. ETC.
and i need to see what character it is on so far..
so if i is on character 15, then some variable will
= 15..
that way i can use it in other ways.
Code:
dim ProChar as <What ever it needs to>
prochar = first character
if prochar= "a" then
'do stuff'
end if
prochar = second character
if prochar= "a" then
'do stuff'
end if
Thanks.. ALOT
-
Nov 25th, 2000, 02:18 AM
#2
Fanatic Member
You need to use arrays and some string manipulation functions to achieve this, here is some code
Code:
Dim str as String ' variable holding string of characters
Dim characters(0 to 149) as String
'................CODE to fill str variable
For i = 0 To 149
characters(i) = Mid(str, i + 1, 1) ' get next character in string
Debug.Print characters(i) ' print characters
Next i
Then you would implement it into your code like this
Code:
prochar = characters(1)
if prochar = "a" then
'do stuff
end if
prochar = characters(2)
if prochar = "a" then
'do stuff
end if
' SO ON
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Nov 25th, 2000, 03:55 AM
#3
Fanatic Member
Originally posted by YoungBuck
Code:
prochar = characters(1)
if prochar = "a" then
'do stuff
end if
prochar = characters(2)
if prochar = "a" then
'do stuff
end if
' SO ON
It's better to do something like this:
Code:
'loop trough all the chars
For i = LBound(characters) To UBound(characters)
'get the char
prochar = character(i)
'do something with it
If prochar = "a" Then
'do something
End if
Next
-
Nov 25th, 2000, 03:59 AM
#4
Fanatic Member
Yeah I was just implementing the use of the array in the code that progeix had provided...........
{Insert random techno-babble here}
{Insert quote from some long gone mofo here}
-
Nov 25th, 2000, 04:57 AM
#5
Thread Starter
Hyperactive Member
Thnanks Guys, I think I can finish my program soon.
And implement new features.
Thanks for the quick response..
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
|