''鍏ㄥ眬瀹氫箟鑷畾涔夊嚱鏁帮紝涓や釜鍙傛暟瑕佺敵鏄? PublicFunctionsplitext(strContentAsString,varTypeAsVariant)
''瀹氫箟鍙橀噺
DimobjRegAsObject
DimobjFoundAsObject
DimtextPatternAsString
Dimarr
SetobjReg=CreateObject("vbscript.regexp")
varType=LCase(varType)
''璁剧疆鍒ゆ柇鍙婂搴旂殑姝e垯琛ㄨ揪寮? SelectCasevarType
Case1,"鏁板瓧"
textPattern="-?\d+(\.\d+)?"
Case2,"鑻辨枃瀛楁瘝"
textPattern="[a-z]+"
Case3,"涓枃"
textPattern="[\u4e00-\u9fa5]+"
EndSelect
WithobjReg
.Global=True
.IgnoreCase=True
.Pattern=textPattern
SetobjFound=.Execute(strContent)
EndWith
IfobjFound.Count=0Then
splitext=""
ExitFunction
EndIf
ReDimarr(0ToobjFound.Count-1)
ForEachcellInobjFound
arr(i)=objFound(i)
i=i+1
Next
splitext=arr
SetobjReg=Nothing
SetobjFound=Nothing
''瀹冪殑浣滅敤灏辨槸鎻愬彇瀛楃涓蹭腑闇€瑕佺殑瀛楃锛岃娉曚负锛歴plitext(strContent,varType)锛?缁撴灉浼氶粯璁よ繑鍥炴壘鍒扮殑绗竴涓瓧绗︼紝濡傛灉鏈夊涓悓绫诲瀷鐨勫瓧绗︼紝鍙互閰嶅悎index鍑芥暟浣跨敤
''varType鍙傛暟涓?鏃讹紝鎻愬彇锛氭暟瀛楋紝涓?鏃讹紝鎻愬彇鑻辨枃锛屼负3鏃讹紝鎻愬彇姹夊瓧
EndFunction
|
|