VB.NET質問スレ(Part34)at TECH
VB.NET質問スレ(Part34) - 暇つぶし2ch915:デフォルトの名無しさん
10/08/11 21:46:41
3万行程度のテキストの、各行にあるカッコ()に囲まれた数字が30以上で且つ"特定の文字列"を含む行、
以外を削除したいと思っています
3千行程度ならば一応このままでも10秒ほどで作業終了するのですが、
それ以上になるとフリーズしてしまいます。解決するにはどうすればいいでしょうか?

Dim lin() As String
Dim textArray As New System.Text.StringBuilder()
RichTextBox1.Text = System.Text.RegularExpressions.Regex.Replace( _
RichTextBox1.Text, _
"(\()(\d*)(\))", _
"separate$2separate")
For i As Integer = 0 To RichTextBox1.Lines.Length - 1
lin = Split(RichTextBox1.Lines(i), "separate", 3)
If lin(0) = RichTextBox1.Lines(i) Then
Else
If lin(1).ToString() > 30 And RichTextBox1.Lines(i).Contains("特定の文字列") = True Then
textArray.Append(lin(0)).Append("(").Append(lin(1)).Append(")").Append(lin(2)).AppendLine()
Else
End If
End If
Next
RichTextBox1.Text = textArray.ToString()


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch