模仿ASP.NET和#039经典ASP中的AppendFormat方法

【模仿ASP.NET和#039经典ASP中的AppendFormat方法】古之立大事者,不惟有超世之才,亦必有坚忍不拔之志。这篇文章主要讲述模仿ASP.NET和#039经典ASP中的AppendFormat方法相关的知识,希望能为你提供帮助。
Learn how to emulate ASP.NET' s AppendFormat method in Classic ASP. AppendFormat is essentially a simple form of concatenation in ASP.NET.

  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
  7.  
  8. response.Write AppendFormat( " Lorem ipsum dolor sit {0} {1} amet, consectetur {1} adipiscing {1} elit." , array( " TEST" ," TEST2" ) )


    推荐阅读