asp 取字符串的问题

来源:百度知道 编辑:UC知道 时间:2024/06/30 17:21:57
比如:
我有http://asc.163.com
或者http://12345.163.com

我想把里面的asc或者12345取出来,应该怎么写哦/?

dim url,str
url="http://12345.163.com"
'以下是函数用以提取字符
function getStr(urlStr)
dim pos
pos=InStr(urlStr,".")
getStr=mid(url,8,(pos-8))
end function
'调用方法
str=getStr(url)
response.write(str)