开发者

extract arabic letter from sentence or word

i am developing a small program in vb6 that will work with an Arabic document, i want to count how many occurrence each Arabic letter appears in the document

basic arabic characters

ا أ إ آ ى ؤ ئ ء ب 开发者_运维百科ت ة ث ج ح خ د ذ ر ز س ش ص ض ط ظ ع غ ف ق ك ل م ن ه

example sentence

البيت الكسز اللتيل الزجاج الست.‏

i don't know arabic or even know how to read it.

if vb6 won't work, i can use vb.net


It'll be much easier to use VB.Net.

  • VB6 has patchy support for Unicode.
  • In VB6, you'd probably need to change your PC system code page to Arabic to be able to read the document.

EDIT: Air code solution in VB.Net, partly based on this answer. It needs exception handling.

''# You may need a different character encoding here, this is UTF-8
Using sr As New IO.StreamReader("Test.txt", Text.Encoding.UTF8)
  Dim c As Char
  Dim dict As New Dictionary(Of String, Integer)

  Do Until sr.EndOfStream
   c = ChrW(sr.Read)

   If (dict.ContainsKey(c))
     dict(c)+=1
   Else
     dict(c) = 1
   End If
  Loop
End Using


The easiest way would be to compare against an array of all Arabic character.. http://en.wikipedia.org/wiki/Arabic_alphabet

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜