我有一字串如下(范例字串)dim temStr as string=AA ABB BBDDDJJ JEEEEGGG GGDDD然后,会有一个配对子:为比如为DDD传进来进到这个函数后会变成前方的DDD被移除了temStr =AAABBBBJJJEEEEGGGGGDDDoutputStr=DDD注意点:这个字串,也有可能出现两次DDD,但只移除一个,移除前面或后面都可以
1 回答
潇湘沐
TA贡献1816条经验 获得超6个赞
Module Module1 Sub Main() Dim temStr As String = "AA ABB BBDDDJJ JEEEEGGG GGDDD" Dim s As String = "DDD" Dim outputStr As String = Nothing If InStr(temStr, s) <> -1 Then temStr = Left(temStr, InStr(temStr, s) - 1) + Right(temStr, Len(temStr) - Len(s) - InStr(temStr, s) + 1) outputStr = s Console.WriteLine(temStr) End If End Sub End Module
- 1 回答
- 0 关注
- 272 浏览
添加回答
举报
0/150
提交
取消