VBS中有类似于VB的getStr的函数吗?

dgseamaple 2004-01-18 09:20:25
我要实现这样的功能:

有一字符串 compatible; msie 6.0; windows nt 5.0; .net clr 1.1.4322

我要返回msie的开始到这个字符串的分号为结束,即读出的结果为: msie 6.0

怎么实现?

看看这个VB的代码例子参考一下:
Function getIEVer
On Error Resume Next
getIEVer = LCase(window.clientInformation.appVersion)
getIEVer = getStr(getIEVer, "msie", ";")
End Function
...全文
84 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xieyj 2004-01-18
  • 打赏
  • 举报
回复
'提取字符串, strSource 源字符串,strBegin 开始字符串,strEnd 截止字符串
Function getStr(strSource, strBegin, strEnd)
Dim si, ei
strSource = LCase(Trim(strSource)) : strBegin = LCase(Trim(strBegin)) : strEnd = LCase(Trim(strEnd))
si = InStr(strSource, strBegin) + Len(strBegin) : ei = InStr(si, strSource, strEnd)
If strBegin = "" Then si = 0
If strEnd = "" Then ei = Len(strSource)
If si > ei Then si = ei
If strBegin = "" And strEnd = "" Then
getStr = strSource
ElseIf strBegin <> "" And strEnd = "" Then
getStr = Trim(Right(Left(strSource, ei), ei - si + 1))
Else
getStr = Trim(Right(Left(strSource, ei - 1), ei - si))
End If
End Function
flying310 2004-01-18
  • 打赏
  • 举报
回复
可以那样读。

28,405

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧