读书人

弱智有关问题汗.

发布时间: 2012-03-02 14:40:28 作者: rapoo

弱智问题,汗...
有字符串
abc*860*er5*wer123*ertqo
现需要把字符串中所有的 "* "转换为 "& "即得到
abc&860&er5&wer123&ertqo
怎么办?

[解决办法]
刚才那边不是已经写了

Dim s As String
s = "abcq***enqe**&ewsx*(&*3asdf34&312&&*** "
Dim reg As Object
Set reg = CreateObject( "vbscript.regexp ")
reg.Pattern = "[!&\*] "
reg.IgnoreCase = True
reg.MultiLine = True
reg.Global = True
MsgBox reg.Replace(s, " ")
reg.Pattern = "[&\*] "
MsgBox reg.Execute(s).Count
[解决办法]
replace ( "abc*860*er5*wer123*ertqo ",“*”,“& ")

读书人网 >VB

热点推荐