PDA

View Full Version : Cannot print the content from a given string using Mid() function


wondergal
10-12-2005, 10:35 AM
I am supposed to return the content value within the tags "<RESULT>SUCCESS</RESULT>". So I had code it as

<%
tmpStartPos = InStr(StrObject, "<RESULT>") + 8 '8 is the length of string "<RESULT>"
tmpEndPos = InStr(StrObject, "</RESULT>")
Set sContent = Mid(StrObject, tmpStartPos + 1, tmpEndPos - tmpStartPos)
%>

but when i try to print out the sContent value, i got nothing.

Can anyone pls point out to me what's the problem?
Thanks alot.

Roelf
10-12-2005, 02:55 PM
remove the Set statement. It is only used to set object references. Not variables.

wondergal
10-13-2005, 04:22 AM
Yaya, thanks alot for sharing....