我有一个VBScript函数,它在做什么?我如何使用C#2.0来简化它。什么是VBScript函数做什么
Function FormatString(format, args)
Dim RegExp, result
result = format
Set RegExp = New RegExp
With RegExp
.Pattern = "\{(\d{1,2})\}"
.IgnoreCase = False
.Global = True
End With
Set matches = RegExp.Execute(result)
For Each match In matches
dim index
index = CInt(Mid(match.Value, 2, Len(match.Value) - 2))
result = Replace(result, match.Value, args(index))
Next
Set matches = nothing
Set RegExp = nothing
FormatString = result
End Function
谢谢!
看起来像VB.NET对我来说,不是的VBScript - 非常不同的动物。 – Tim