ASP 字符处理
'根據tag獲取con的左側字符串
Function GetLeftPart(Con, tag)if instr(con,tag)>0 thenGetLeftPart = Left(Con, InStr(Con, tag) - 1)elseGetLeftPart = ""end if
End Function'根據tag1和tag2獲取con的中間字符串
Function GetBetweenPart(Con, tag1, tag2)if instr(con,tag1)>0 and instr(con,tag2)>0 thenGetBetweenPart = GetLeftPart(GetRightPart(Con, tag1), tag2)elseGetBetweenPart = ""end if
End Function'根據tag獲取con的右側字符串
Function GetRightPart(Con, tag)if instr(con,tag)>0 thenGetRightPart = Right(Con, Len(Con) - InStr(Con, tag) - Len(tag) + 1)elseGetRightPart = ""end if
End Function'-----------------字符Unicode編碼與反編碼----------------------
Function CodeToUni(code)dim ix,thisStr,ThisCode,newcodeif code="" thencodetouni=""exit functionend if for ix=1 to len(code)thisstr=right(left(code,ix),1)thiscode=hex(ascw(thisstr))if len(thiscode)=1 thenthiscode="000"+thiscodeelseif len(thiscode)=2 thenthiscode="00"+thiscode elseif len(thiscode)=3 thenthiscode="0"+thiscode end ifnewcode=newcode+thiscodenextcodetouni=newcodeEnd FunctionFunction UniToCode(unic)dim ixx,thisUni,oricode,fst,sec,trd,fth,oristrif unic="" thenunitocode=""exit functionend iffor ixx=1 to len(unic)/4thisuni=right(left(unic,ixx*4),4) if left(thisuni,2)="00" thenthisuni=right(thisuni,2)fst=gethexv(right(thisuni,1))sec=gethexv(left(thisuni,1))oricode=chr(sec*16+fst)oristr=oristr+oricodeelse fst=gethexv(right(thisuni,1))sec=gethexv(right(left(thisuni,3),1))trd=gethexv(right(left(thisuni,2),1))fth=gethexv(left(thisuni,1))oricode=chrw(fth*16*16*16+trd*16*16+sec*16+fst)oristr=oristr+oricodeend if nextunitocode=oristrEnd FunctionFunction GetHexV(ST)SELECT CASE STCASE "0"GETHEXV=0CASE "1"GETHEXV=1 CASE "2"GETHEXV=2CASE "3"GETHEXV=3 CASE "4"GETHEXV=4CASE "5"GETHEXV=5 CASE "6"GETHEXV=6CASE "7"GETHEXV=7 CASE "8"GETHEXV=8CASE "9"GETHEXV=9 CASE "A"GETHEXV=10CASE "B"GETHEXV=11 CASE "C"GETHEXV=12CASE "D"GETHEXV=13 CASE "E"GETHEXV=14CASE "F"GETHEXV=15 END SELECTEnd Function'----------------------------------------------
?
轉載于:https://www.cnblogs.com/lichsky/p/3308332.html
總結
- 上一篇: 设计模式读书笔记-----代理模式
- 下一篇: 转载的孩子们注意节操哈!!!