Emulate ASP.NET's AppendFormat Method In Classic ASP

/ Published in: ASP
Save to your folder(s)

Learn how to emulate ASP.NET's AppendFormat method in Classic ASP. AppendFormat is essentially a simple form of concatenation in ASP.NET.

Copy this code and paste it in your HTML
  1. function AppendFormat(input,arr)
  2. for i = 0 to ubound(arr)
  3. input = replace(input,"{" & i & "}",arr(i))
  4. next
  5. AppendFormat = input
  6. end function
  8. response.Write AppendFormat("Lorem ipsum dolor sit {0} {1} amet, consectetur {1} adipiscing {1} elit.", array("TEST","TEST2"))

URL: http://www.nealgrosskopf.com/tech/thread.asp?pid=54

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.