-

- 加为好友
- 发送私信
- 在线聊天
happy_sea
- 等级:

- 可用分等级:
- 总技术专家分:
- 总技术专家分排名:
-
|
| 发表于:2008-07-24 10:43:447楼 得分:0 |
如果你说的是网页地址,比如这个帖子的url http://topic.csdn.net/u/20080724/09/bdc81309-4a43-4197-89cc-1d21c6a134da.html 那么可以用下面的代码: - VB code
Private Sub Command1_Click()
Dim strUrl As String, strResult As String
Dim nStart As Integer, nEnd As Integer
strUrl = "http://topic.csdn.net/u/20080724/09/bdc81309-4a43-4197-89cc-1d21c6a134da.html"
nStart = InStrRev(strUrl, "/") + 1
nEnd = InStrRev(strUrl, ".")
strResult = Mid(strUrl, nStart, nEnd - nStart)
Debug.Print strResult
End Sub
我是为了让你看得更明白才写这么复杂,其实只要下面一句就足够了: - VB code
Debug.Print Mid(strUrl, InStrRev(strUrl, "/") + 1, InStrRev(strUrl, ".") - InStrRev(strUrl, "/") - 1)
如果不是网址,其他字符串也可类似处理。 | | |
修改
删除
举报
引用
回复
| |