[thelist] Anal String Replace (ASP)
Peter Brunone (EasyListBox.com)
peter at easylistbox.com
Thu Oct 14 14:16:36 CDT 2004
Hi Rob,
Are all the file extensions three letters? Even if it could be three or four, you could hack the last four or five characters off the filename, do the replace there, and then slap the end piece back on...
Of course if you can do RegExps in your version of VBScript, that might be the better option, but that's not my area of expertise.
Cheers,
Peter
From: Rob Smith rob.smith at THERMON.com
Anal as in strict,
I have a file name:
filename = "Abbrv. State Names.htm"
What I'd like to do is:
filename = replace(filename,".","")
However this yields:
Abbrv State Nameshtm... not good
o o
-------000--^--000-------
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,
Rob Smith
More information about the thelist
mailing list