[RESOLVED] How to remove everything after last slash(/) including slash itself ?
hi all . i am extracting a list of urls from webbrowser controle but i want to remove everthing after the last slash including the slash . could any one telll me how this can be done? thanks
Example the urls are like this
aHref.href=123456/new-song-album1 and i want to get only this part only :123456 then add it to listbox. I want to do this process in loop for all values of aHref.href.
Code:
Private Sub Command2_Click()
Dim doc As HTMLDocument
Dim aHref As HTMLAnchorElement
Set doc = WebBrowser1.Document
For Each aHref In WebBrowser1.Document.All.tags("A")
List1.AddItem aHref.href
Next aHref
End Sub
Re: How to remove everything after last slash(/) including slash itself ?
single split should do the trick
Code:
Private Sub Command2_Click()
Dim doc As HTMLDocument
Dim aHref As HTMLAnchorElement
dim hrefSPLIT() as string
Set doc = WebBrowser1.Document
For Each aHref In WebBrowser1.Document.All.tags("A")
hrefSPLIT = split(aHref.href,"/")
List1.AddItem hrefSPLIT(0)
Next aHref
End Sub
Re: [RESOLVED] How to remove everything after last slash(/) including slash itself ?
Max many many thanks it solved the problem!:)