![]() |
Web Development »
ASP »
General
License: The Code Project Open License (CPOL)
String.Format equivalentBy John DohertyVBScript/ASP version of the C# string.format("this {0} a {1}","is","test") |
VBScript, ASP
|
||||||||
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
Classic ASP - String.Format equivalent function
I 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.
Speaks 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"))
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 2 Dec 2008 Editor: |
Copyright 2008 by John Doherty Everything else Copyright © CodeProject, 1999-2009 Web09 | Advertise on the Code Project |