Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace Application Variable TEXT with Replace Function

Status
Not open for further replies.

CrimsonDiva

Programmer
Sep 22, 2000
30
US
Hello,

I am trying to replace all occurrences of &quot;<%=Application(&quot;HtcRootSite&quot;)%>&quot; with &quot;/staging&quot; for a particular file.

This is the code I tried using (Vbscript/ASP):

str is a string reference to a file using an application variable.

str = Replace(str, &quot;<%=Application(&quot;&quot;HTCRootSite&quot;&quot;)%>&quot;, &quot;/staging&quot;)

This does not work because it's trying to read the ending delimeter &quot;%>&quot; instead of recognizing it as part of a string. I get the following error &quot;Unterminated string Constant&quot;.

Can someone please help!
 
My guess is that you are doing this server-side, so the correct syntax is...

str = Replace(str, Application(&quot;HTCRootSite&quot;), &quot;/staging&quot;) Get the Best Answers! faq333-2924
&quot;A witty saying proves nothing.&quot; - Voltaire
mikewolf@tst-us.com
 
I think I see what your doing, you were reading the path from an application variable and now you want to change that to hardcoded, yes?
Try this:
Code:
str = Replace(str, &quot;<%=Application(&quot;&quot;HTCRootSite&quot;&quot;)%&quot; & &quot;>&quot;, &quot;/staging&quot;)
Technically legal but a little messy. Should do the trick :)

-Tarwn ________________________________________________________________________________
Want to get great answers to your Tek-Tips questions? Have a look at faq333-2924
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top