تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[كود] تصحيح او تعديل كود البحث في نص مشكل
#2
وعليك السلام ورحمة الله وبركاته

اخوي عبد الهادي هذا السؤال من فطاحلة الاسئلة

وانا حاولت ولم اوفق لان طريقة الحل بحسب اسلوبي معقدة جدا وتحتاج الى وقت طويل
لكني الحمدلله استمتع بمثل هذي الاسئلة

واسمحلي اعرض محاولة حلي من باب تقديري لفكرة السؤال
وشكرا

كود :
Public Class Form1
    Dim harkat() As Char = {"", "َ", "ُ", "ِ", "ّ", "ْ", "ًّ", "ُّ", "ِّ", "ً", "ٌ", "ٍ"}
    Dim mot3, mot2, mot1 As String
    Dim resul As New ArrayList

    Dim WChars() As Char
    Dim pp = 0
    Dim newWord As String = ""
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim str = TextBox1.Text
        WChars = str.ToCharArray
        ListBox1.Items.Clear()
        resul.Clear()

        Analyse()
    End Sub

    Sub Analyse()
        Static CharCounter As Integer
        Static HarkahCounter As Integer
        Static limit As Integer
        newWord = ""
        'Do
        Application.DoEvents()
        For a As Integer = 0 To WChars.Count - 1

            newWord &= WChars(a) & harkat(HarkahCounter)

            CharCounter += 1
        Next
        ListBox1.Items.Add(newWord)
        resul.Add(newWord)
        pp += 1
        Label1.Text = pp
        If (CharCounter) = TextBox1.TextLength Then
            'newWord = newWord.Substring(0, 2)

            limit += 1
            CharCounter = 0

            If HarkahCounter < harkat.Count - 1 Then
                HarkahCounter += 1
                Analyse()
            Else
                HarkahCounter = 0
            End If

        End If

        'Loop


    End Sub


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim mm = 0
        RichTextBox1.SelectAll()
        RichTextBox1.SelectionColor = Color.Black
        For Each sa As String In resul
            Dim index = RichTextBox1.Text.LastIndexOf(sa)
            If index <> -1 Then
                RichTextBox1.Find(sa, index, RichTextBox1.TextLength, RichTextBoxFinds.None)
                RichTextBox1.SelectionColor = Color.Red
                mm += 1
            End If
        Next


        Label2.Text = mm


    End Sub
End Class

الرد }}}
تم الشكر بواسطة: عبد الهادي بهاب , ابراهيم ايبو


الردود في هذا الموضوع
RE: تصحيح او تعديل كود البحث في نص مشكل - بواسطة معاند الحظ - 16-09-20, 03:08 AM


التنقل السريع :


يقوم بقرائة الموضوع: