vb6如何在txt中查找字符然后选定该行并以预设内容替换之?
答案:1 悬赏:70 手机版
解决时间 2021-01-09 23:36
- 提问者网友:酱爆肉
- 2021-01-08 23:08
vb6如何在txt中查找字符然后选定该行并以预设内容替换之?
最佳答案
- 五星知识达人网友:举杯邀酒敬孤独
- 2021-01-08 23:30
Private Sub Command1_Click()
Dim t As Integer
Dim i, j As Integer
Dim str(100) As String
Open "e:ead.txt" For Input As #1
For i = 0 To 99
If Not EOF(1) Then Line Input #1, str(i) Else t = i: Exit For
Next
Close
For i = 0 To UBound(str)
If Left(str(i), 4) = "font" Then
str(i) = "font2: tahoma"
End If
Next
Open "e:ead.txt" For Output As #1
For j = 0 To t - 1: Print #1, str(j): Next
Close #1
End Sub追问劳烦讲解下全过程的思路 谢谢 :)
Dim t As Integer
Dim i, j As Integer
Dim str(100) As String
Open "e:ead.txt" For Input As #1
For i = 0 To 99
If Not EOF(1) Then Line Input #1, str(i) Else t = i: Exit For
Next
Close
For i = 0 To UBound(str)
If Left(str(i), 4) = "font" Then
str(i) = "font2: tahoma"
End If
Next
Open "e:ead.txt" For Output As #1
For j = 0 To t - 1: Print #1, str(j): Next
Close #1
End Sub追问劳烦讲解下全过程的思路 谢谢 :)
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯