Page 1 of 1

VB tag remover!

Posted: Thu Aug 05, 2004 7:26 pm
by Joe
This is a silly place to ask this but I seem to get help with whatever language I choose in these forums so I will give it a try.

I am looking for a quick snippet writtin in Visual Basic 6.0 that returns the string which is in between the <title> tag. For example if my form had something like <title>My Form</title> the program would result with "My Form".

Any help appreciated.

Regards


Joe 8)


*EDIT BY Joe* I think the code would be better using timers as loops seem to be unreliable with large amounts of code.

Posted: Thu Aug 05, 2004 7:39 pm
by feyd
why do you want it in VB?

Posted: Thu Aug 05, 2004 7:40 pm
by Joe
Well I am doing a little project for college and VB was my choice of language.

Posted: Thu Aug 05, 2004 8:49 pm
by tim
you'll never win a 'VB is a good coding langauge' with feyd, so dont even try.

hahaha

8)

Posted: Thu Aug 05, 2004 9:51 pm
by Joe
lol ok well it was worth a try :D

Posted: Thu Aug 05, 2004 10:13 pm
by sell-traffic
Yes, ignore the "VB is bad comments," I understand the argument, but it's still great for rapid development in my opinion. You would have to load the source into VB with a Inet Control. Then Instr() it for everything between <Title> and </Title>.

Good luck,

Josh

Posted: Thu Aug 05, 2004 10:16 pm
by Joe
Yeah thanks however, I require no controls, instead I use winsock in order to achieve the source from websites. :D

Posted: Fri Aug 20, 2004 9:47 am
by AngusL

Code: Select all

'Load source

Source = Cstr(Left(Source,  8))
Source = Cstr(Right(Source, 8))
Should do it.

Posted: Tue Aug 24, 2004 9:37 pm
by Illusionist
that would only work, if and only if <title>whatever</title> as the only thing in the source, and even then if it was something else it would be wrong. instead try this:

Code: Select all

tmp = Right(txtSource, Len(txtSource) - (InStr(LCase(txtSource), "<title>") + 6))
txtTitle = Left(tmp, InStr(LCase(tmp), "</title>") - 1)