'字符串格式化Format
'str 被格式化的字符串
'strArry 占位符数组,数组索引必须与占位符数字一致
function FormatString(str,strArry)
dim tempStr,index
tempStr=str
index=0
for each val in strArry
dim placeholder
placeholder="{"+Cstr(index)+"}"
tempStr=Replace(tempStr,placeholder,val)
index=index+1
next
FormatString=tempStr
end function
使用
dim str,stra(3)
str="ab{0}c{1}{2}dd{1}"
stra(0)="00"
stra(1)="11"
stra(2)="22"
FormatString(str,stra)
输出
ab00c1122dd11