|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
IntroductionClassic ASP - String.Format equivalent function BackgroundI am working on an old ASP classic application (fixing bugs etc). Have to say, I still love traditional classic ASP. It takes moments to do something that would normally take hours in .Net, plus it always feels so much faster to execute =) Anyway, I needed a function similar to string.format in C#. I could not find anything on Google so created my own and thought I would share. Using the codeSpeaks for itself I think! Function StringFormat(sVal, aArgs) Dim i For i=0 To UBound(aArgs) sVal = Replace(sVal,"{" & CStr(i) & "}",aArgs(i)) Next StringFormat = sVal End Function StringFormat("this {0} a tes{1} string containing {2} values", Array("is","t","some"))
|
||||||||||||||||||||||