列入text1里面的内容有
(图片地址)D:\001.jpg(/图片地址)
(图片地址)D:\051.jpg(/图片地址)
(图片地址)D:\071.jpg(/图片地址)
(图片地址)D:\0a1.jpg(/图片地址)
(图片地址)D:\0e1.jpg(/图片地址)
(图片地址)D:\0s0升kklll1.jpg(/图片地址)
......
还有很多很多,文件名没有规矩
怎么获取(图片地址)到(/图片地址)之间的字符串而且获取的路径不同一个文件
不能将(图片地址)替换成无字符串,因为还有很多的指令。
VB获取字符串到字符串之间的字符串搜索
答案:1 悬赏:80 手机版
解决时间 2021-04-23 23:28
- 提问者网友:爱了却不能说
- 2021-04-23 10:00
最佳答案
- 五星知识达人网友:未来江山和你
- 2021-04-23 11:24
用len,dir(路径), Mid, Right
具体方法,自己去想想,给你一段类似的
Dim DwgPath As String
Dim DwgName As String
Dim TxtName As String
Dim FistName As String
Dim IniLine As String
Dim iniFile As String
Dim StX As Integer
Dim StD As Integer
Dim DwgNamelen As Long
Dim TxtNameLen As Long
Dim LinLen As Long
Dim AcadApp As Object
ListBox1.ClearListBox2.Clear
If Dir(App.Path & "\" & ListBox3.List(ListBox3.ListIndex) & ".ini") = "" ThenMsgBox "文件缺失,请检查" & App.Path & "\" & ListBox3.List(ListBox3.ListIndex) & ".ini 文件", vbExclamation, "图块插入"
End
End If
DwgPath = App.Path & "\DwgBlock\"iniFile = App.Path & "\" & ListBox3.List(ListBox3.ListIndex) & ".ini"
Open iniFile For Input As #1 Do While Not EOF(1)
Line Input #1, IniLine
LinLen = Len(IniLine)
For i = 1 To LinLen
If Mid(IniLine, i, 1) = "*" Then StX = 1: TxtNameLen = i
If Mid(IniLine, i, 1) = "," Then StD = StX + 1: DwgNamelen = i
Next i
If StD = 2 And StX = 1 And TxtNameLen <> 1 And DwgNamelen <> LinLen Then
TxtName = Left(IniLine, TxtNameLen - 1)
DwgName = Replace(IniLine, Left(IniLine, DwgNamelen), "")
If Dir(DwgPath & DwgName & ".dwg") <> "" Then
ListBox1.AddItem TxtName
ListBox2.AddItem DwgName
End If
End If
StX = 0: StD = 0
Loop
Close #1
具体方法,自己去想想,给你一段类似的
Dim DwgPath As String
Dim DwgName As String
Dim TxtName As String
Dim FistName As String
Dim IniLine As String
Dim iniFile As String
Dim StX As Integer
Dim StD As Integer
Dim DwgNamelen As Long
Dim TxtNameLen As Long
Dim LinLen As Long
Dim AcadApp As Object
ListBox1.ClearListBox2.Clear
If Dir(App.Path & "\" & ListBox3.List(ListBox3.ListIndex) & ".ini") = "" ThenMsgBox "文件缺失,请检查" & App.Path & "\" & ListBox3.List(ListBox3.ListIndex) & ".ini 文件", vbExclamation, "图块插入"
End
End If
DwgPath = App.Path & "\DwgBlock\"iniFile = App.Path & "\" & ListBox3.List(ListBox3.ListIndex) & ".ini"
Open iniFile For Input As #1 Do While Not EOF(1)
Line Input #1, IniLine
LinLen = Len(IniLine)
For i = 1 To LinLen
If Mid(IniLine, i, 1) = "*" Then StX = 1: TxtNameLen = i
If Mid(IniLine, i, 1) = "," Then StD = StX + 1: DwgNamelen = i
Next i
If StD = 2 And StX = 1 And TxtNameLen <> 1 And DwgNamelen <> LinLen Then
TxtName = Left(IniLine, TxtNameLen - 1)
DwgName = Replace(IniLine, Left(IniLine, DwgNamelen), "")
If Dir(DwgPath & DwgName & ".dwg") <> "" Then
ListBox1.AddItem TxtName
ListBox2.AddItem DwgName
End If
End If
StX = 0: StD = 0
Loop
Close #1
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯