2:正则System.Text.Regex替换,用RegExpOption修改是否支持大小写。
3:在小数据的情况下,使用String.SubString和+可以实现间接替换。
4:导入MicrosoftVisualBasicRunTime(Microsoft.VisualBasic.DLL)使用Strings.Replace速度很快。
5:参照反射Reflector.FileDisassembler配合Strings.SplitandStrings.Join等实现。
以下为引用的内容:
privatestaticstringReplaceEx(stringoriginal,
stringpattern,stringreplacement)
{
intcount,position0,position1
count=position0=position1=0
stringupperString=original.ToUpper()
stringupperPattern=pattern.ToUpper()
intinc=(original.Length/pattern.Length)*
(replacement.Length-pattern.Length)
char[]chars=newchar[original.Length+Math.Max(0,inc)]
while((position1=upperString.IndexOf(upperPattern,
position0))!=-1)
{
for(inti=position0i<position1++i)
chars[count++]=original[i]
for(inti=0i<replacement.Length++i)
chars[count++]=replacement[i]
position0=position1+pattern.Length
}
if(position0==0)returnoriginal
for(inti=position0i<original.Length++i)
chars[count++]=original[i]
returnnewstring(chars,0,count)
}
文本框 TextBox1
上一条 Button1
下一条 Button2
修改 Button3
Imports System.IOPublic 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
元数据(Meta Data)是关于数据仓库的数据,指在数据仓库建设过程中所产生的有关数据源定义,目标定义,转换规则等相关的关键数据。同时元数据还包含关于数据含义的商业信息,所有这些信息都应当妥善保存,并很好地管理。为数据仓库的发展和使用提供方便。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)