[thelist] Anal String Replace (ASP)

Vlad Alexander (XStandard) vlad.alexander at xstandard.com
Thu Oct 14 13:34:47 CDT 2004


Hi Rob,

First, break the string in half at the last period like this:

strText = "abc.def.ghi"
i = InStrRev(strText, ".")
strLeft = Left(strText, i - 1)
strRight = Mid(strText, i + 1)

Then manipulate the left half as you need and then concatenate the string together:

strText = Replace(strLeft, ".", "") & "." & strRight

Regards,
-Vlad
http://xstandard.com
Standards-compliant XHTML WYSIWYG editor



----- Original Message ----- 
From: "Rob Smith" <rob.smith at THERMON.com>
To: "Thelist (E-mail)" <thelist at lists.evolt.org>
Sent: Thursday, October 14, 2004 1:20 PM
Subject: [thelist] Anal String Replace (ASP)


> 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
> -- 
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester 
> and archives of thelist go to: http://lists.evolt.org 
> Workers of the Web, evolt ! 
> 



More information about the thelist mailing list