第1个回答 2019-01-01
用
Split()
函数差分,再用
Join()
函数合并(也可以直接用
&
连接)。
举例:
Dim
S()
as
String
S
=
Split("张某-陕西西安-205房间",
"-")
Debug.Print
S(0)
&
S(2)
'结果是
张某205房间
第2个回答 2008-08-16
建一个Command1。
代码如下。
====================
Private Sub Command1_Click()
Dim s As String
s = "<td><P><p><font color=""#ff00ff"" size=""3"">1111:2233445566</font></p>"
Dim i As Integer
i = InStr(1, s, "1111:")
s = Mid(s, i + 5, InStr(i, s, "</font>") - i - 5)
MsgBox s
End Sub本回答被提问者采纳
第3个回答 2019-12-02
我胡乱写了一段代码,请你参照一下
Dim
aa
As
String
Dim
t
As
Integer
aa
=
"张某-陕西西安-205房间"
t
=
InStr(1,
aa,
"-")
MsgBox
Left(aa,
t
-
1)
t
=
InStr(t
+
1,
aa,
"-")
MsgBox
Right(aa,
Len(aa)
-
t)
第4个回答 2008-08-16
阁下是需要清除html标记,只保留网页中的文本吧,你可以试一下这个算法;
s=me.text1.text 's中保留网页源码;
private funcation ClsHtml(s as string)
dim t as string
dim c as string
dim k as string
t=""
while(len(s))
c=left(s,1)
s=right(s,len(s)-1)
if c='<' or c='>' then k=c
if k='>' and c<>'<' and c<> '>' then t=t & c
wend
ClsHtml=t '返回结果;
end funcation
本函数清除"<"与">"之间的所有字符串;