当前位置:编程学习 > VB >>

清除字符串中指定的字符

 

      

该函数在字符串 s 中清除 Search(注意:如果 s 为 AAABBB,Search 为 AB。如何?) :

 

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

补充:软件开发 , Vb ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,