الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

استخلاص جميع الجمل الموجودة بين علامتين

بدأه ramysarwat في 28 مايو 2009 · 2 رد · 380 مشاهدة · في Microsoft Visual Basic.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

كيف استطيع استخلاص جميع الجمل الواقع بين علامتين على سبيل المثال لدينا

[w]test1[/w][w]test2[/w][w]test3[/w][w]test4[/w]

كيف يمكن استخلاص test1 و test2 و test3 و test4 ووضعها فى ليست بوكس

#2
		Dim x As String
		Dim y

		x = "[w]test1[/w][w]test2[/w][w]test3[/w][w]test4[/w]"

		x = Replace(x, "[w]", "")
		'X Now Equal test1[/w]test2[/w]test3[/w]test4[/w]
		x = Replace(x, "[/w]", "!")
		'X Now Equal test1!test2!test3!test4!

		y = Split(x, "!")


		For index As Integer = 0 To UBound(y) - 1
			ListBox1.Items.Add(y(index))
		Next
#3

مرحباً أخي الكريم,

يمكنك أيضاً استخدام شيء من هذا القبيل :

 

[color= #000000; font-weight: bold;]Public [color= #000000; font-weight: bold;]Class Form1

    [color= #000000; font-weight: bold;]Private [color= #000000; font-weight: bold;]Function GetInfo[color= #009900;](ByVal CText [color= #b1b100;]As String[color= #009900;]) [color= #b1b100;]As String[color= #009900;]([color= #009900;])

        Dim ListOfInfo [color= #b1b100;]As [color= #000000; font-weight: bold;]New [color= #990000;]List[color= #009900;](Of String[color= #009900;])

        Dim GotTag [color= #b1b100;]As Boolean [color= #339933;]= [color= #000000; font-weight: bold;]False

        Dim Index [color= #b1b100;]As Int32 [color= #339933;]= [color= #cc66cc;]0

        Dim Content [color= #b1b100;]As String [color= #339933;]= String[color= #339933;].[color= #990000;]Empty

        [color= #b1b100;]Do Until Index [color= #339933;]= CText[color= #339933;].Length [color= #339933;]- [color= #cc66cc;]1

            [color= #b1b100;]If CText[color= #009900;](Index[color= #009900;]) [color= #339933;]= [color= #0000ff;]"[" Then

                [color= #b1b100;]If GotTag Then

                    ListOfInfo[color= #339933;].Add[color= #009900;](Content[color= #009900;])

                    GotTag [color= #339933;]= [color= #000000; font-weight: bold;]False

                [color= #b1b100;]Else

                    GotTag [color= #339933;]= [color= #000000; font-weight: bold;]True

                [color= #990000;]End [color= #b1b100;]If

                Content [color= #339933;]= String[color= #339933;].[color= #990000;]Empty

                Index [color= #339933;]+= [color= #cc66cc;]2

            [color= #b1b100;]Else

                Content [color= #339933;]&= CText[color= #009900;](Index[color= #009900;])

            [color= #990000;]End [color= #b1b100;]If

            Index [color= #339933;]+= [color= #cc66cc;]1

        Loop

        [color= #b1b100;]Return ListOfInfo[color= #339933;].ToArray

    [color= #990000;]End [color= #000000; font-weight: bold;]Function

 

    [color= #000000; font-weight: bold;]Private Sub Button1_Click[color= #009900;](ByVal sender [color= #b1b100;]As [color= #990000;]System[color= #339933;].Object[color= #339933;], ByVal e [color= #b1b100;]As [color= #990000;]System[color= #339933;].EventArgs[color= #009900;]) Handl
es Button1[color= #339933;].Click

        ListBox1[color= #339933;].Items[color= #339933;].AddRange[color= #009900;](GetInfo[color= #009900;](TextBox1[color= #339933;].Text[color= #009900;])[color= #009900;])

    [color= #990000;]End Sub

 

[color= #990000;]End [color= #000000; font-weight: bold;]Class

جرب المثال من المرفقات

WindowsApplication1.rar

تم تعديل هذه المشاركة بواسطة Bashar Rabat في 28 مايو 2009 في 04:35

The important thing is not so much

that every child should be taught,

as that every child should be given the wish to learn.

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر ساعة · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…