女宝宝剃头发型图:移除字串中不要的字符

来源:百度文库 编辑:偶看新闻 时间:2024/05/06 00:14:41
32、移除字串中不要的字符
参数 : 1:要检查的字串 [准备移除其中某些字符]
2:要移除的字符 (数字/中英文)
程序码
Function StringCleaner(s As String, Search As String) As String
Dim i As Integer, res As String
res = s
Do While InStr(res, Search)
i = InStr(res, Search)
res = Left(res, i - 1) & Mid(res, i + 1)
Loop
StringCleaner = res
End Function
返回值 移除某些字符后的字串
实例 :
我想移除 Text1 中的字符 "A"
Text1 = StringCleaner(Text1, "A")