[thelist] Anal String Replace (ASP)

Anthony Baratta Anthony at Baratta.com
Thu Oct 14 13:51:40 CDT 2004


Rob Smith wrote:

> 
> What I think I may have to do, but this is the LONG way around
> 
> filename = replace(filename,".","_")
> filename = replace(filename,"_htm",".htm")
> filename = replace(filename,"_cad",".cad")
> filename = replace(filename,"_doc",".doc")
> filename = replace(filename,"_xls",".xls")
> filename = replace(filename,"_pdf",".pdf")
> 
> ...and so on and so forth for every known file extension to restore the file
> name.
> 
> There has GOT to be a smarter way around this. Ideas,

How about this?

replace(filename,".","::",InStrRev(filename,"."),1)
replace(filename,".","")
replace(filename,"::",".")

--
Anthony Baratta

"I used to think the brain was the most
  important part of my body, until I realized
  what was telling me that." - Emo Phillips


More information about the thelist mailing list