VB 怎么提取指定字符中的内容
答案:2 悬赏:70 手机版
解决时间 2021-03-26 19:04
- 提问者网友:饥饿走向夜
- 2021-03-26 11:51
VB 怎么提取指定字符中的内容
最佳答案
- 五星知识达人网友:野味小生
- 2021-03-26 12:25
Dim Ystr As String
Dim Tstr() As String
Dim n As Integer
Dim YesNo As Boolean
Dim Lstr As String
Dim i As Integer
Ystr = "iegiuhrjknbe.walhio[jkgshaugui]bhsagyueajbdnbs,u[kauyuibaqjbcu]nbagajshvbhj[我啊不能兼顾噶额级别]jhasbdjhjaehujhejb[你看历史回顾IU感激不尽安静]hi回去啊U价格比较昂贵醋意[bjkhajhiuqahilhg]nbjklsabhjkbj"
n = 0
YesNo = False
For i = 1 To Len(Ystr)
If Not YesNo Then
If Mid(Ystr, i, 1) = "[" Then
Lstr = Mid(Ystr, i, 1)
YesNo = True
End If
Else
Lstr = Lstr & Mid(Ystr, i, 1)
If Mid(Ystr, i, 1) = "]" Then
n = n + 1
ReDim Preserve Tstr(n) As String
Tstr(n) = Lstr
YesNo = False
End If
End If
Next i
For i = 1 To UBound(Tstr)
Debug.Print Tstr(i)
Next i
Dim Tstr() As String
Dim n As Integer
Dim YesNo As Boolean
Dim Lstr As String
Dim i As Integer
Ystr = "iegiuhrjknbe.walhio[jkgshaugui]bhsagyueajbdnbs,u[kauyuibaqjbcu]nbagajshvbhj[我啊不能兼顾噶额级别]jhasbdjhjaehujhejb[你看历史回顾IU感激不尽安静]hi回去啊U价格比较昂贵醋意[bjkhajhiuqahilhg]nbjklsabhjkbj"
n = 0
YesNo = False
For i = 1 To Len(Ystr)
If Not YesNo Then
If Mid(Ystr, i, 1) = "[" Then
Lstr = Mid(Ystr, i, 1)
YesNo = True
End If
Else
Lstr = Lstr & Mid(Ystr, i, 1)
If Mid(Ystr, i, 1) = "]" Then
n = n + 1
ReDim Preserve Tstr(n) As String
Tstr(n) = Lstr
YesNo = False
End If
End If
Next i
For i = 1 To UBound(Tstr)
Debug.Print Tstr(i)
Next i
全部回答
- 1楼网友:骨子里都是戏
- 2021-03-26 13:50
Private Sub Command1_Click()
Dim str As String, i As Long, strs() As String
str = "iegiuhrjknbe.walhio[jkgshaugui]bhsagyueajbdnbs,u[kauyuibaqjbcu]nbagajshvbhj[我啊不能兼顾噶额级别]jhasbdjhjaehujhejb[你看历史回顾IU感激不尽安静]hi回去啊U价格比较昂贵醋意[bjkhajhiuqahilhg]nbjklsabhjkbj"
strs() = Split(str, "[")
For i = 1 To UBound(strs)
Debug.Print Left(strs(i), InStr(strs(i), "]") - 1)
Next i
End Sub
Dim str As String, i As Long, strs() As String
str = "iegiuhrjknbe.walhio[jkgshaugui]bhsagyueajbdnbs,u[kauyuibaqjbcu]nbagajshvbhj[我啊不能兼顾噶额级别]jhasbdjhjaehujhejb[你看历史回顾IU感激不尽安静]hi回去啊U价格比较昂贵醋意[bjkhajhiuqahilhg]nbjklsabhjkbj"
strs() = Split(str, "[")
For i = 1 To UBound(strs)
Debug.Print Left(strs(i), InStr(strs(i), "]") - 1)
Next i
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯