منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : استفسار :- بخصوص التفريق بين الحروف الكبيره والصغيره
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
السلام عليكم ورحمة الله


عندي كود يقراء ملف

والحروف في الملف مرات يكون حروف كبيره ومرات حروف صغيره

الكود عندي شغال بس اريد اغيره 

مثلا اذا في نفس الملف في حروف كبيره او صغيره ما يفرق بينهم

الكود اللي عندي 

كود :
           Dim Rgx As Regex = New Regex("<eor>")

           Dim Rgx2 As Regex = New Regex("<EOR>")

اول شي يفحص الملف اذا كانت هذه الكلمه
إقتباس :<eor>

صغيره يعمل كذا

كود :
 If Rgx.IsMatch(txt) Then
               ms = Strings.Split(txt, "" & "eor" & ">", -1, CompareMethod.Binary)

          MsgBox("eor")


واذا كانت كبيره

كود :
           ElseIf Rgx2.IsMatch(txt) Then
               ms = Strings.Split(txt, "" & "EOR" & ">", -1, CompareMethod.Binary)
       
MsgBox("EOR")
           End If
       


الكود كامل



كود :
   Dim fd As OpenFileDialog = New OpenFileDialog() With {.Filter = "ADI files (*.ADI)|*.ADI"}
       If fd.ShowDialog() = DialogResult.OK Then
           lblAttach.Text = fd.FileName
           txt = Computer.FileSystem.ReadAllText(fd.FileName)

           Dim Rgx As Regex = New Regex("<eor>")

           Dim Rgx2 As Regex = New Regex("<EOR>")
If Rgx.IsMatch(txt) Then
               ms = Strings.Split(txt, "" & "eor" & ">", -1, CompareMethod.Binary)

          MsgBox("eor")

           ElseIf Rgx2.IsMatch(txt) Then
               ms = Strings.Split(txt, "" & "EOR" & ">", -1, CompareMethod.Binary)
       
MsgBox("EOR")
           End If
       
       


اتوقع التغيير من هنا

كود :
     ms = Strings.Split(txt, "" & "EOR" & ">", -1, CompareMethod.Binary)


حاولت اغير بس ما ضبط

بارك الله فيكم

وشكرا
بما أنك تستخدم Regex جرب هذا
كود :
Dim fd As OpenFileDialog = New OpenFileDialog() With {.Filter = "ADI files (*.ADI)|*.ADI"}
If fd.ShowDialog() = DialogResult.OK Then
   lblAttach.Text = fd.FileName
   txt = IO.File.ReadAllText(fd.FileName)
   MS = Regex.Split(txt, "<eor>", RegexOptions.IgnoreCase)
End If
لاحظ RegexOptions.IgnoreCase وتعني تجاهل حالة الأحرف
(01-10-18, 02:19 AM)rnmr كتب : [ -> ]بما أنك تستخدم Regex جرب هذا
كود :
Dim fd As OpenFileDialog = New OpenFileDialog() With {.Filter = "ADI files (*.ADI)|*.ADI"}
If fd.ShowDialog() = DialogResult.OK Then
   lblAttach.Text = fd.FileName
   txt = IO.File.ReadAllText(fd.FileName)
   MS = Regex.Split(txt, "<eor>", RegexOptions.IgnoreCase)
End If
لاحظ RegexOptions.IgnoreCase وتعني تجاهل حالة الأحرف


صباح الخير

الحمدالله ضبط معاي شكرا بارك الله فيك  الله يزيدك علما

احسنت Rolleyes