大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
文本框 TextBox1
创新互联建站提供网站设计制作、成都做网站、网页设计,品牌网站制作,一元广告等致力于企业网站建设与公司网站制作,10多年的网站开发和建站经验,助力企业信息化建设,成功案例突破上1000家,是您实现网站建设的好选择.
上一条 Button1
下一条 Button2
修改 Button3
Imports System.IO
Public Class Form1
Dim currIndex As Integer = 0
Dim s2 As List(Of String) = New List(Of String)
Dim s As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
s = File.ReadAllText(Application.StartupPath "\txt.txt")
Dim s1 As String() = s.Split("@")
For i As Integer = 0 To s1.Length - 1
If s1(i).Trim() "" Then
s2.Add("@" s1(i))
End If
Next
TextBox1.Text = s2(0)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
currIndex = currIndex + 1
If currIndex s2.Count - 1 Then
MsgBox("已经是最后条了")
Return
End If
TextBox1.Text = s2(currIndex)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
currIndex = currIndex - 1
If currIndex 0 Then
MsgBox("已经是第一条了")
Return
End If
TextBox1.Text = s2(currIndex)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
s2(currIndex) = TextBox1.Text
s = ""
For i As Integer = 0 To s2.Count - 1
s = s2(i)
Next
File.WriteAllText(Application.StartupPath "\txt.txt", s)
End Sub
End Class
读500万行的txt文件190m左右,提取每行中特定字符,写入7个文件,单个文件130万行,13m左右。一共用时20秒左右。
用system.io.streamreader
system.io.streamwriter。
语法错误,没有存储函数的返回值。
temp.Replace("111", "22")
这个函数方法返回修改后的结果,并不修改参数变量本身,也就是按值传递,而不是按地址传递,正确用法:
temp=temp.Replace("111", "22")
x="a[11dsfsf]b"
b=x.lastindexof("]")
a=x.indexof("[")
x=x.substring(0,a) "0" x.substring(b)