Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bonkers!
Message
From
06/02/2003 12:05:30
 
 
To
28/01/2003 00:54:51
General information
Forum:
Visual Basic
Category:
VBScript
Title:
Miscellaneous
Thread ID:
00746078
Message ID:
00749965
Views:
27
Hi,

How about a sample of your string?

For example, if your string looks like this:
"start1234endstart5678endthis is a teststart111end",
then maybe the following code will work

If not, then tweek the code to make it work for you....

Hope this helps,
Mike
Dim myString, lnLoop, lnPos1, lnPos2
myString = "start1234endstart5678endthis is a teststart111end"
lnPos1 = 1
lnPos2 = 1
Do While True
  lnPos1 = InStr(lnPos2, myString, "start", 1)
  If lnPos1>0 Then
    lnPos1 = lnPos1 + 5
    lnPos2 = InStr(lnPos1, myString, "end", 1)
    If lnPos2>0 Then
      Response.Write Mid(myString, lnPos1, lnPos2-lnPos1) & "<BR>"
    End If
  Else
    Exit Do
  End If
Loop
>Hi All,
>
>I have been attempting to do a function for a couple of days now and I have got to the stage if I have to look at it again I am going to go bonkers.
>
>I want my function to read through a string where I have a several start and end tags inside a lode of text.
>
>I want to right out from the start tag to the end tag every time the start to end tags appear in the string.
>
>This is what I have and I don't think I'm that far off.
>
>
>lb = "start"
>rb = "end"
>StrString = a
>lbStrPosition = ""
>		
>For Each StrEachTag In Split(StrString, Len(lb) - 5)
>	If lbStrPosition = "" Then
>		lbStrPosition = 1
>	Else
>		lbStrPosition = lbStrPosition + 3
>	End If
>	lbStrPosition = InStr(lbStrPosition, StrString, lb)
>	rbStrPosition = InStr(lbStrPosition, StrString, rb)
>	StrEnd = rbStrPosition - lbStrPosition + Len(rb)
>	Response.Write Mid(StrString , lbStrPosition, StrEnd)
>Next
>
>
>I might be way off but if any VBScript Guru can help me I would really appreciate it.
>
>Kind Regards,
>Tarran Walker
Previous
Reply
Map
View

Click here to load this message in the networking platform