可以用Split函数来实现也可以用Replace
用Replace实现
Function DelIDStr(IDStr,DelID)
DelIDStr=Replace(IDStr,DelID&",","")
End Function
用Split实现
Function DelIDStr(IDStr,DelID)
Dim TempAry
Dim ReStr
Dim i
ReStr=""
TempAry=Split(IDStr,",")
For i=0 To UBound(TempAry)
IF TempAry(i)<>DelID Then
ReStr=ReStr&TempAry(i)&","
End IF
Next
DelIDStr=Mid(ReStr,1,Len(ReStr)-1)
End Function
Response.Write "字符串'1,2,3'里删除3"
Response.Write "删除后的字符串为'"&DelIDStr("1,2,3","3")&"'"