|
-
Apr 5th, 2002, 01:29 PM
#1
Thread Starter
New Member
String Manipulation, please Help???
I've got the following html code (string) within a Rich TextBox, can anyone tell me how I can search through this string to locate the substring "The winning balls for draw number 654 on 30 March 2002 were", and extract this to another Text box.
Please note that this is an online VB application using Inet, so the substring (draw no. and date) will change every week.
I'm assuming I need to use the InStr and Mid functions ???
Thanks in advance: GT.
<IMG SRC="images/results/onresu02.jpg" ALT="Saturday" WIDTH=152 HEIGHT=37 BORDER=0><br>
The winning balls for draw number 654 on 30 March 2002 were:<BR CLEAR=ALL>
<IMG SRC="images/results/numbers/num08.gif" ALT="08" WIDTH=53 HEIGHT=54 BORDER=0>
<IMG SRC="images/results/numbers/num14.gif" ALT="14" WIDTH=53 HEIGHT=54 BORDER=0>
<IMG SRC="images/results/numbers/num25.gif" ALT="25" WIDTH=53 HEIGHT=54 BORDER=0>
<IMG SRC="images/results/numbers/num36.gif" ALT="36" WIDTH=53 HEIGHT=54 BORDER=0>
<IMG SRC="images/results/numbers/num38.gif" ALT="38" WIDTH=53 HEIGHT=54 BORDER=0>
<IMG SRC="images/results/numbers/num47.gif" ALT="47" WIDTH=53 HEIGHT=54 BORDER=0>
-
Apr 5th, 2002, 01:47 PM
#2
Lively Member
Off the top of my head
VB Code:
Private Sub Command1_Click()
Dim v As Variant
Dim x As Integer
v = Split(RichTextBox.Text, "images/results/numbers/")
RichTextBox.Text = ""
For counter = 1 To UBound(v)
RichTextBox.Text = RichTextBox.Text & Mid(v(counter), 4, 2) & " "
Next counter
End Sub
In case of a water landing, my head may be used as a flotation device.
-
Apr 5th, 2002, 01:50 PM
#3
Member
Give this a try....
VB Code:
position1 = InStr(1, RichTextBox1.Text, "The winning balls for draw number")
position2 = InStr(position1, RichTextBox1.Text, "were:")
tBox2.Text = Mid(RichTextBox1.Text, position1, (position2 + 4))
Wend
lordsty
Last edited by lordsty; Apr 5th, 2002 at 01:55 PM.
-
Apr 5th, 2002, 01:52 PM
#4
Assuming that the exact string "The winning balls" will be
replicated in every set:
Code:
xxx = instr(RTC,"The winning balls for draw number ") + 34
yyy = instr(RTC," on ")
zzz = instr(RTC," were:")
drawnumber = mid$(RCT,xxx,(yyy-xxx))
drawdate=mid$(RTC, yyy+4,zzz-(yyy+4))
qqq = instr(RTC,".gif")
while qqq > 0
ballnum = ballnum & mid$(RTC,qqq-2,2) & " "
qqq = instr(qqq+1,RTC,".gif")
wend
where RTC = RichTextstring
at the end you should have
drawnumber = "654"
drawdate= "30 March 2002"
ballnum="08 14 25 36 38 47"
you might have to play with +1 or -1 on the ranges, the problem
begets fencepost problems all over the place.
HTH
-
Apr 5th, 2002, 01:54 PM
#5
PowerPoster
Or you can try this method
VB Code:
Private Sub Command1_Click()
Dim Stren() As String, Stren2() As String, Number1() As String
Dim Number2() As String, Number3() As String, Number4() As String
Dim Number5() As String, Number6() As String
Stren = Split(Text1, ">")
Stren2 = Split(Stren(2), ":")
Number1 = Split(Stren(3), """")
Number2 = Split(Stren(4), """")
Number3 = Split(Stren(5), """")
Number4 = Split(Stren(6), """")
Number5 = Split(Stren(7), """")
Number6 = Split(Stren(8), """")
MsgBox Stren2(0) & ": " & Number1(3) & "," & Number2(3) & "," & Number3(3) & "," & Number4(3) & "," & Number5(3) & "," & Number6(3)
End Sub
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

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
|