我有一個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