91视频国产免费-一区二区三区不卡av-国自产拍偷拍精品啪啪av-免费在线视频一区二区-中日黄色片-免费污片在线观看-偷拍青青草-日本黄色高清-国产视频手机在线播放-国产激情在线-午夜tv影院-日本中文字幕网-男女黄色录像-日日夜夜草-九色91蝌蚪-太粗太深了太紧太爽了动态图-97久久精品

當前位置: 博客首頁 >> 網頁設計制作 >> 取兩字符串之間的字符串的函數(shù) rss

取兩字符串之間的字符串的函數(shù)

成都網站優(yōu)化 在 2010-05-03 發(fā)表,評論(0),閱讀(0)

<%
'取中間字符串
function getmidstr(L,R,str)

  int_left
=instr(str,L)
  int_right
=instr(str,R)

  
If int_left>0 and int_right>0 Then
  getmidstr
=mid(str,int_left+len(L),int_right-int_left-len(L))
  
Else
  getmidstr
="執(zhí)行的字符串中不包含“"&L&"”或“"&R&""


  End If
end function

str
="www.goodtext.org"
response.write 
"<BR>"&getmidstr("go","xt",str)
’將輸出
"odte"
%
>

擴展模式:

<%
'取中間字符串
function getmidstr(L,R,str,m,n) 
          
'm,n為控制參數(shù),表示輸出的字符串將分別向左,向右多輸出m,n個字符。
  int_left=instr(str,L)
  int_right
=instr(str,R)

  
if (m="left"then   '若m為“l(fā)eft”,輸出的字符串將包含左邊部分(L),下同
  m=len(L)
  
end if
  
if (n="right"then

  n=len(R)
  
end if

  
if (m>(len(L)+int_left-1)) then
  m
=(len(L)+int_left-1)
  
end if
  
If int_left>0 and int_right>0 Then

  getmidstr=mid(str,int_left+len(L)-m,int_right-int_left-len(L)+n+m)
  
Else
  getmidstr
="執(zhí)行的字符串中不包含“"&L&"”或“"&R&""

  End If
end function

str
="abcdefghijk"
response.write 
"<BR>"&getmidstr("bcd","hi",str,0,0


‘輸出"efg"
response.write 
"<BR>"&getmidstr("bcd","hi",str,2,1


‘輸出"cdefgh"
response.write 
"<BR>"&getmidstr("bcd","hi",str,"left","right"
‘輸出
"bcdefghi"


%
>

Tags:取中間字符串,ASP

思為網絡騰訊企業(yè)微博,請關注我們:
已有位網友對“取兩字符串之間的字符串的函數(shù)”發(fā)表評論。

 

www.sw996.com/seoblog/
金川县| 武鸣县| 甘肃省| 夹江县| 宜黄县| 托克托县| 盐池县| 睢宁县| 龙山县| 西和县| 青田县| 临武县| 油尖旺区| 浦江县| 新化县| 普兰县| 策勒县| 通道| 大埔区| 涞水县| 天长市| 淳安县| 沾化县| 南召县| 双桥区| 理塘县| 云安县| 昌邑市| 枣庄市| 分宜县| 海阳市| 辽阳县| 辽阳市| 宁蒗| 武功县| 金堂县| 永顺县| 开化县| 女性| 百色市| 邹平县|