从句子或单词中提取阿拉伯字母 [英] extract arabic letter from sentence or word
问题描述
我正在用 vb6 开发一个可以处理阿拉伯文文档的小程序,我想计算文档中每个阿拉伯字母出现的次数
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
基本阿拉伯字符
ا أ إ آ ى ؤ ئ ء ب ت ة ث ج ح خ د ذ ر ز س ش ص ض ط ظ ع غ ف ق ك ل م ن ه
ا أ إ آ ى ؤ ئ ء ب ت ة ث ج ح خ د ذ ر ز س ش ص ض ط ظ ع غ ف ق ك ل م ن ه
例句
البيت الكسز اللتيل الزجاج الست.
البيت الكسز اللتيل الزجاج الست.
我不会阿拉伯语,甚至不知道如何阅读.
i don't know arabic or even know how to read it.
如果 vb6 不起作用,我可以使用 vb.net
if vb6 won't work, i can use vb.net
推荐答案
使用 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.
编辑:VB.Net 中的空气代码解决方案,部分基于 这个答案.它需要异常处理.
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
这篇关于从句子或单词中提取阿拉伯字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!