Esato Mobile
General discussions : Non mobile discussion : string searching in VB.Net
> New Topic
> Reply
< Esato Forum Index > General discussions > Non mobile discussion > string searching in VB.Net Bookmark topic
luvsanro Posts: 156

hi guyz whats up, need some help on topic subjected .

i want to search for a string within another string
e.g.<link rel="alternate" type="application/rss+xml" title="Mt RSS Feed" href="smsbysan.8m.com" >i want to get the title string & the href string.

_________________
Download All MMS Clips[url=www.smsbysan.8m.com]Here[/url].First Subscribe to smsbysan group.

[ This Message was edited by: luvsanro on 2006-01-08 14:39 ]
--
Posted: 2006-01-08 15:34:33
Edit : Quote

Cycovision Posts: > 500

You'll need to use the 'indexof' and 'substring' functions. 'indexof' finds the excact text that you want (eg. ) and returns it's numerical position in the string. You can then use this value with 'substring' to cut out the info that you want and place it in a new variable.

More info, including a couple more functions that you'll need, and some examples here:

http://www.planet-source-code[....]de.asp?txtCodeId=169&lngWId=10
--
Posted: 2006-01-08 16:08:43
Edit : Quote

Cycovision Posts: > 500

You'll need to use the 'indexof' and 'substring' functions. 'indexof' finds the excact text that you want (eg. <title>) and returns it's numerical position in the string. You can then use this value with 'substring' to cut out the info that you want and place it in a new variable.

More info, including a couple more functions that you'll need, and some examples here:

http://www.planet-source-code[....]sp?txtCodeId=169&lngWId=10
--
Posted: 2006-01-08 16:13:16
Edit : Quote

luvsanro Posts: 156

can u please code it for me ?
--
Posted: 2006-01-08 16:13:56
Edit : Quote

Debu Posts: > 500

I whipped up this sample application for you to explain the string searching using looping structures in vb. In this tiny program, you enter the Esato URL, ad it will tell you the topc ID.




you can dowload the project file (Visual Studio 2005) from here:

http://rapidshare.de/files/10705075/Sample_String_Search.zip.html


here is the code:


Quote:




Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a, b As String
' Dim topicno As Long
Dim i, k As Integer

b = ""

a = Me.url.Text
For i = 0 To (a.Length - 1)
If a(i) = "?" Then
Exit For

End If
Next

i = i + 7
For k = 0 To ((a.Length - 1) - (i))
b = b & a(i)
i = i + 1
Next
Me.Label3.Text = b


End Sub
End Class






I know this isnt the best way, but i'm more of a C# guy, VB isn't exactly my strong point, and anyways this does the trick.
--
Posted: 2006-01-09 12:17:52
Edit : Quote

luvsanro Posts: 156

thats good but
first i cant find the link where to click on rapidshare website .mail me [ ](remove spaces & add .com).
Second i dont want to look inside a url in addess bar .

i am trying to retieve the html from the webpage that is docStr where ,docStr is:
Code:
Dim docStr As mshtml.IHTMLElement
docStr = docText.documentElement


_________________
Download All MMS ClipsHere.First Subscribe to smsbysan group.

[ This Message was edited by: luvsanro on 2006-01-10 12:50 ]
--
Posted: 2006-01-09 13:20:05
Edit : Quote

Debu Posts: > 500

On the rapidshare page that opens click the 'free' button near the bottom of the page, I will email you the file in any case by this evening. You can use this same method for an html doctype, just parse the html to text, but as I said this isn't the most efficient method, ideally you could make a class which would search only via the line number on the html page. If you are using 2005, there are system.xml, and system.web classes where you could make a repeating node element and search.

--
Posted: 2006-01-09 13:49:00
Edit : Quote

New Topic   Reply
Forum Index

Esato home