C
cgqok
Unregistered / Unconfirmed
GUEST, unregistred user!
能帮我把这段ASP的截取函数转为delphi里能用的函数吗?
Function Getstr(wstr,star,over,n)//wstr为要截取的字符串,star为开始标记,over为结束标记,n为出现的位置
dim midstr,cstar,cover,i,yn
midstr=wstr
yn=0
for i=1 to n
cstar=Newstring(midstr,star)
if cstar=len(midstr) then yn=1
midstr=mid(midstr,cstar+len(star))
next
if yn=0 then
cover=Newstring(midstr,over)
Getstr=mid(midstr,1,cover-1)
else
Getstr="捕捉失败"
end if
End Function
Function Newstring(wstr,strng)
Newstring=Instr(lcase(wstr),lcase(strng))
if Newstring<=0 then Newstring=Len(wstr)
End Function
Function Getstr(wstr,star,over,n)//wstr为要截取的字符串,star为开始标记,over为结束标记,n为出现的位置
dim midstr,cstar,cover,i,yn
midstr=wstr
yn=0
for i=1 to n
cstar=Newstring(midstr,star)
if cstar=len(midstr) then yn=1
midstr=mid(midstr,cstar+len(star))
next
if yn=0 then
cover=Newstring(midstr,over)
Getstr=mid(midstr,1,cover-1)
else
Getstr="捕捉失败"
end if
End Function
Function Newstring(wstr,strng)
Newstring=Instr(lcase(wstr),lcase(strng))
if Newstring<=0 then Newstring=Len(wstr)
End Function