|
-
Jun 28th, 2003, 06:38 PM
#1
Thread Starter
Lively Member
Im going to be very specific... (string finding/manipulation)
Alrighty,
I am ALMOST finsihed with the current program i am writing, i need to do one simple thing:
I have 51 of these: http://vnboards.ign.com/user.asp?usr=<number> strings in a textbox, Now, im looking to use ALL 51 of thoes strings, but first i need to recognize them, I know exactally how to find the FIRST string, and take what i need from it, but i cant say the same for all the others... im using this to find the first string right now:
Code:
Function finduid()
Dim iEnd As Integer
spam = TextBox2.Text
Dim inner As String = "/user.asp?usr="
uid = (spam.Substring(spam.IndexOf(inner), 25))
uid = (Mid(uid, 15, 25))
iEnd = uid.LastIndexOf(">") - 1
uid = uid.Substring(0, iEnd - 0).Trim
Trim(uid)
End Function
But i have no idea how to even begin to search for the next string, or the string after that...
Also, how could i check for repeat strings?
Any help anyone could offer would be great!
thanks a ton
-
Jun 28th, 2003, 07:08 PM
#2
ok i'm assuming you have the items listed in the textbox below eachother , like this :
http://vnboards.ign.com/user.asp?usr=1
http://vnboards.ign.com/user.asp?usr=2
http://vnboards.ign.com/user.asp?usr=3
with that in mind you can do this :
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i As Integer
Dim strString As String
For i = 0 To TextBox1.Lines.Length - 1
strString = Split(TextBox1.Lines(i).ToString, "=")(1)
MsgBox("the user's number is: " & strString)
Next
End Sub
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Jun 28th, 2003, 07:35 PM
#3
Thread Starter
Lively Member
Hmmm, will split return all the instances of that string?
Also if it makes a difference, im pulling all of this information out of an HTML page
Oh didnt see that, no, they are not listed below eachother
Last edited by Azkar; Jun 28th, 2003 at 07:45 PM.
-
Jun 28th, 2003, 08:48 PM
#4
Fanatic Member
Use regular expressions!
VB Code:
For Each m As System.Text.RegularExpressions.Match In _
System.Text.RegularExpressions.Regex.Matches(sSearch, "(?<=\?usr=)-?\d+\.?\d*")
Process(m.Value)
Next
sSearch is the string you want to search, and Process is just a function that does something with the value. (You can just use it in code and not call a function...) That regular expression will match negative numbers and reals, as well as plain old positive integers.
I have two simple requests: 1) Use useful and specific topics. 2) Modify your topic to include [Resolved] when you problem has been resolved. Both of these make the bulletin boards more useful and efficient. Thanks.
-
Jun 28th, 2003, 08:55 PM
#5
Thread Starter
Lively Member
'Ah hmmm, ill play around with that tomorrow, thanks
Last edited by Azkar; Jun 28th, 2003 at 10:19 PM.
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
|