s="adsfdf.wer234.useString.erewr2.tertwer" a=split(a,".") b=a(2) msgbox b
打错了一个字 s="adsfdf.wer234.useString.erewr2.tertwer" a=split(s,".") b=a(2) msgbox b
dim ss as string dim arr() as varient ss="adsfdf.wer234.useString.erewr2.tertwer" arr=split(ss,".") 'split是用“.”把字符串分組的函數結果: arr(0)=adsfdf arr(1)=wer234 arr(2)=useString arr(3)=erewr2 arr(4)=tertwer你想要得到的是:arr(2)=useString
1. Function getit(ByVal x As String) As String getit = Split(x, ".")(2) End Function2. Function getit(ByVal x As String) As String getit = x getit = Mid(getit, InStr(getit, ".") + 1) getit = Mid(getit, InStr(getit, ".") + 1) getit = Left(getit, InStr(getit, ".") - 1) End Function
a=split(a,".")
b=a(2)
msgbox b
s="adsfdf.wer234.useString.erewr2.tertwer"
a=split(s,".")
b=a(2)
msgbox b
dim arr() as varient
ss="adsfdf.wer234.useString.erewr2.tertwer"
arr=split(ss,".") 'split是用“.”把字符串分組的函數結果:
arr(0)=adsfdf
arr(1)=wer234
arr(2)=useString
arr(3)=erewr2
arr(4)=tertwer你想要得到的是:arr(2)=useString
Function getit(ByVal x As String) As String
getit = Split(x, ".")(2)
End Function2.
Function getit(ByVal x As String) As String
getit = x
getit = Mid(getit, InStr(getit, ".") + 1)
getit = Mid(getit, InStr(getit, ".") + 1)
getit = Left(getit, InStr(getit, ".") - 1)
End Function
Private Sub Command1_Click()
s = "adsfdf.wer234.useString.erewr2.tertwer"
MsgBox Mid(s, InStr(InStr(1, s, ".") + 1, s, ".") + 1, InStr(InStr(InStr(1, s, ".") + 1, s, ".") + 1, s, ".") - InStr(InStr(1, s, ".") + 1, s, ".") - 1)
End Sub