Matching Sentences Problems Arising In The Array

ctjh900801

Member
Joined
Aug 30, 2011
Messages
5
Programming Experience
Beginner
In my program I run into trouble.
Please help solve the problem.
First, let me describe what I want to feature me of the problem.
I Function SPLITyahoomessage () to intercept the statement, the statement should not be captured through the interception.
Here I use x () array to the breakpoint.
But I say there are two windows in the pm 10:10 swept the first window of the sentence recorded in x (0) in
Then x (1) record from the second window of the sentence.
Here is a very strange x (0) memory from the sentence.
Here are the features I want to achieve
It will break out in the interception of sentence in accordance with the procedure.
But the second window x (1) I gradually during the scan, I found that x (1) had memorized the sentence re-enter
SPLITyahoomessage () in the time x (1) into nothing.
Code:
VB.NET:
 Dim u As Integer    Dim x() As String
   Public Function SPLITyahoomessage() As Long  




        u = Val(ListBox1.SelectedIndex)


        ca = Len(TextBox1.Text)             
        If ca > 0 Then
            Exit Function
        End If






        Dim lCount1 As Integer
        lCount1 = 0
        If ListBox1.SelectedIndex < 0 Then
            Exit Function
        End If
        Dim textBuilder As String = ListBox1.Items(ListBox1.SelectedIndex)


        'TextBox1
        '----------------------------
        Dim textBuilders() As String = Split(textBuilder, " (")
        For i As Integer = 0 To textBuilders.Length - 1




        Next




        Dim InputText As String = RichTextBox3.Text
        '-----------------------------
       


        Dim nowdate As String = Now.ToString("yyyy/M/d")


        Dim saveNow As DateTime = DateTime.Now   




        Dim hour As String = saveNow.Hour


        Dim minute As String = saveNow.Minute


        minute = minute - 1
        '-------------------------------------------------
    
        Dim 上下午 As String
        If hour >= 12 Then


            AMPM = "PM"
            hour = hour - 12


        Else
            AMPM = "AM"
            If hour = 0 Then
                hour = 12
            End If
        End If


        '-------------------------------------------------
        If hour <= 9 Then      
            hour = String.Concat("0", hour)
        End If


        If minute <= 9 Then
            minute = String.Concat("0", minute)
        End If




        '-------------------------------------------------


        Dim regex As Regex = New Regex(textBuilders(0) & " \(" & nowdate & " " & AMPM & " " & hour & ":" &minute  & ":[0-5]\d{1}\): (?<text>.*)")
        '-------------------------------------------------
        ReDim Preserve x(0)
        ReDim Preserve x(1)


        If x(1) = regex.ToString Then
            Exit Function
        End If


        If x(0) = regex.ToString Then
            Exit Function
        End If
      








        '------------------------------------------
        Dim matches As MatchCollection = regex.Matches(InputText)
        '-------------------------------------------------------


        Dim intCount As Integer = 0
        For Each m As Match In matches
            Dim result As String = m.Groups("text").Value
            intCount += 1
            Me.Controls("TextBox" & intCount).Text = result
        Next
        '----------------------------------------
        x(u) = regex.ToString 




        '-------------------------------------------


        Return lCount1
        Exit Function




    End Function

Please help me solve the problem .
Thank you.
 
Back
Top