返回指定位置的字符串

'==================================================================================
'函数名:SubString
'作 用:返回指定位置的字符串,包含EndIndex位置上的字符
'参 数:Objstr   //字符串对象
'    StartIndex //开始位置,从1算起
'    EndIndex  //结束位置,从1算起
'返回值:指定位置字符串
'==================================================================================
function SubString(ObjStr,StartIndex,EndIndex)
    if ObjStr="" then exit function
    ObjStr=mid(ObjStr,StartIndex,EndIndex-StartIndex+1)
    
    SubString=ObjStr
end function


实例说明:

dim Str

Str="123456789"

response.write SubString(Str,1,5) '输出结果:12345



枫叶随风网

http://www.fengyekun.com

你可能感兴趣的:(ASP自编函数)