有这样几个 string
“this is test ! ip = '192.168.0.1' ,end”
“ ip = '192.168.0.1' ,end”
“here ip = '192.168.0.2'!”
程序如何写 将以上String 中ip=后面的内容该为ip = '1.1.1.1'
得到如:
“this is test ! ip = '1.1.1.1' ,end”
“this is test ! ip = '192.168.0.1' ,end”
“ ip = '192.168.0.1' ,end”
“here ip = '192.168.0.2'!”
程序如何写 将以上String 中ip=后面的内容该为ip = '1.1.1.1'
得到如:
“this is test ! ip = '1.1.1.1' ,end”
tmpstr = Left(surstr, InStr(surstr, "'")) & "1.1.1.1" & Right(surstr, Len(surstr) - InStrRev(surstr, "'") + 1)
MsgBox tmpstr
Dim strIP As String
Dim YourString As StringYourString = "this is test ! ip = '192.168.0.1' ,end"i = InStr(1, YourString, "'")
j = InStrRev(YourString, "'")
strIP = Mid(YourString, i, j - i + 1)YourString = Replace(YourString, strIP, "'1.1.1.1'")
“this is test !email = '[email protected]' ,ip = '192.168.0.1' ,end”
就是说多了几个单引号