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 danielledunham on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replace method doesn't work

Status
Not open for further replies.

920506

Programmer
Joined
Jun 13, 2003
Messages
201
Location
US
Hi all,
I was confused. I thought it should be very straightforward.
I have the following code:

namestr="Peippp-hua ggSun"

call Replace(namestr, "-", "abc")
response.write namestr
response.end

after replace call, the namestr still have the "-" in the original place. What went wrong?
Thank you,
Betty
 
try
Code:
namestr = "Peippp-hua ggSun"
namestr = Replace(namestr, "-", "abc")
Response.Write namestr
Response.End()
 
Hi unclerico,
thank you. that works. But when I read the some web pages, it states it is a sub, not a function, so I thought it won't return any value, it will replace the namestr directly. Even asp error message says
replace(namestr, oldvaule, newvalue) should not include "(" because it is a sub.
Maybe I misundertood it.

Thank you!
Betty
 
Replace "Function" is a built in function in the vbscript scripting engine. You do not use the "Call" method on any built in functions.

The Replace "Method" is something different and requires a instance of the regular expression object

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top