zanghani
08-20-2003, 03:16 PM
I want to know how I can use the function below to recognize end of a string. I'm using the function below to parse a string from a query string in a url. It works perfectly until I try to ask it to return a string from a special character to the end.
For example, if I make the following call: Parse(Request("display"),"_","-") and the string is display=some_string-1, it'll give me "string", but how do i get the number "1"?
Please help.
Function Parse(StringToParse,StartParseChar,EndParseChar)
lMarker = 1
lEndMarker = 1
sTemp = ""
Do
lMarker = InStr(lMarker, StringToParse, StartParseChar)
if (lMarker > 0) Then
lMarker = Len(StartParseChar) + lMarker
if (lMarker > Len(StringToParse)) Then Exit Do
lEndMarker = InStr(lMarker, StringToParse, EndParseChar)
if (lEndMarker > 0) Then
sTemp = Mid(StringToParse, lMarker, lEndMarker - lMarker)
Else
Exit Do
End if
End if
Loop Until lMarker = 0
Parse=sTemp
End Function
For example, if I make the following call: Parse(Request("display"),"_","-") and the string is display=some_string-1, it'll give me "string", but how do i get the number "1"?
Please help.
Function Parse(StringToParse,StartParseChar,EndParseChar)
lMarker = 1
lEndMarker = 1
sTemp = ""
Do
lMarker = InStr(lMarker, StringToParse, StartParseChar)
if (lMarker > 0) Then
lMarker = Len(StartParseChar) + lMarker
if (lMarker > Len(StringToParse)) Then Exit Do
lEndMarker = InStr(lMarker, StringToParse, EndParseChar)
if (lEndMarker > 0) Then
sTemp = Mid(StringToParse, lMarker, lEndMarker - lMarker)
Else
Exit Do
End if
End if
Loop Until lMarker = 0
Parse=sTemp
End Function