作者热门文章
- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我想检查字符串是否包含阿拉伯文本。两个字符串都是阿拉伯语。
我试过使用 contains 方法但它不起作用,不知道为什么会这样。
_ayahList.forEach((item) {
if (item.arabic.trim().contains(searchTxt.trim())) {
_searchAyahList.add(item);
}
});
但它不起作用。
编辑
搜索文本الَّذِينوْوَوُوا ووْوُّوا عون سوِيلِ ال
阿拉伯文字الَّذِينَ كوفَرُوا وَصودُّوا عون سوِيلِ اللوّهِ أوضوُُوا أَعْموالوهُمْ
搜索文本 2:الروّحِيمِ محمد
阿拉伯文文本 2:بِسْمِ اللوِّهِ الروّحْموٰنِ الروّحِيمِ محمد
最佳答案
它有助于 normalize首先是字符串,以删除变音符号。
void main() {
String t2 = 'بِسْمِ اللَِّهِ الرَّحْمَٰنِ الرَّحِيمِ محمد';
String s2 = 'الرَّحِيمِ محمد';
print(t2);
String nt2 = normalise(t2);
print(nt2);
print(t2.codeUnits);
print(nt2.codeUnits);
print(s2);
String ns2 = normalise(s2);
print(ns2);
print(s2.codeUnits);
print(ns2.codeUnits);
print(nt2.contains(ns2)); // prints "true"
}
String normalise(String input) => input
.replaceAll('\u0610', '') //ARABIC SIGN SALLALLAHOU ALAYHE WA SALLAM
.replaceAll('\u0611', '') //ARABIC SIGN ALAYHE ASSALLAM
.replaceAll('\u0612', '') //ARABIC SIGN RAHMATULLAH ALAYHE
.replaceAll('\u0613', '') //ARABIC SIGN RADI ALLAHOU ANHU
.replaceAll('\u0614', '') //ARABIC SIGN TAKHALLUS
//Remove koranic anotation
.replaceAll('\u0615', '') //ARABIC SMALL HIGH TAH
.replaceAll(
'\u0616', '') //ARABIC SMALL HIGH LIGATURE ALEF WITH LAM WITH YEH
.replaceAll('\u0617', '') //ARABIC SMALL HIGH ZAIN
.replaceAll('\u0618', '') //ARABIC SMALL FATHA
.replaceAll('\u0619', '') //ARABIC SMALL DAMMA
.replaceAll('\u061A', '') //ARABIC SMALL KASRA
.replaceAll('\u06D6',
'') //ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA
.replaceAll('\u06D7',
'') //ARABIC SMALL HIGH LIGATURE QAF WITH LAM WITH ALEF MAKSURA
.replaceAll('\u06D8', '') //ARABIC SMALL HIGH MEEM INITIAL FORM
.replaceAll('\u06D9', '') //ARABIC SMALL HIGH LAM ALEF
.replaceAll('\u06DA', '') //ARABIC SMALL HIGH JEEM
.replaceAll('\u06DB', '') //ARABIC SMALL HIGH THREE DOTS
.replaceAll('\u06DC', '') //ARABIC SMALL HIGH SEEN
.replaceAll('\u06DD', '') //ARABIC END OF AYAH
.replaceAll('\u06DE', '') //ARABIC START OF RUB EL HIZB
.replaceAll('\u06DF', '') //ARABIC SMALL HIGH ROUNDED ZERO
.replaceAll('\u06E0', '') //ARABIC SMALL HIGH UPRIGHT RECTANGULAR ZERO
.replaceAll('\u06E1', '') //ARABIC SMALL HIGH DOTLESS HEAD OF KHAH
.replaceAll('\u06E2', '') //ARABIC SMALL HIGH MEEM ISOLATED FORM
.replaceAll('\u06E3', '') //ARABIC SMALL LOW SEEN
.replaceAll('\u06E4', '') //ARABIC SMALL HIGH MADDA
.replaceAll('\u06E5', '') //ARABIC SMALL WAW
.replaceAll('\u06E6', '') //ARABIC SMALL YEH
.replaceAll('\u06E7', '') //ARABIC SMALL HIGH YEH
.replaceAll('\u06E8', '') //ARABIC SMALL HIGH NOON
.replaceAll('\u06E9', '') //ARABIC PLACE OF SAJDAH
.replaceAll('\u06EA', '') //ARABIC EMPTY CENTRE LOW STOP
.replaceAll('\u06EB', '') //ARABIC EMPTY CENTRE HIGH STOP
.replaceAll('\u06EC', '') //ARABIC ROUNDED HIGH STOP WITH FILLED CENTRE
.replaceAll('\u06ED', '') //ARABIC SMALL LOW MEEM
//Remove tatweel
.replaceAll('\u0640', '')
//Remove tashkeel
.replaceAll('\u064B', '') //ARABIC FATHATAN
.replaceAll('\u064C', '') //ARABIC DAMMATAN
.replaceAll('\u064D', '') //ARABIC KASRATAN
.replaceAll('\u064E', '') //ARABIC FATHA
.replaceAll('\u064F', '') //ARABIC DAMMA
.replaceAll('\u0650', '') //ARABIC KASRA
.replaceAll('\u0651', '') //ARABIC SHADDA
.replaceAll('\u0652', '') //ARABIC SUKUN
.replaceAll('\u0653', '') //ARABIC MADDAH ABOVE
.replaceAll('\u0654', '') //ARABIC HAMZA ABOVE
.replaceAll('\u0655', '') //ARABIC HAMZA BELOW
.replaceAll('\u0656', '') //ARABIC SUBSCRIPT ALEF
.replaceAll('\u0657', '') //ARABIC INVERTED DAMMA
.replaceAll('\u0658', '') //ARABIC MARK NOON GHUNNA
.replaceAll('\u0659', '') //ARABIC ZWARAKAY
.replaceAll('\u065A', '') //ARABIC VOWEL SIGN SMALL V ABOVE
.replaceAll('\u065B', '') //ARABIC VOWEL SIGN INVERTED SMALL V ABOVE
.replaceAll('\u065C', '') //ARABIC VOWEL SIGN DOT BELOW
.replaceAll('\u065D', '') //ARABIC REVERSED DAMMA
.replaceAll('\u065E', '') //ARABIC FATHA WITH TWO DOTS
.replaceAll('\u065F', '') //ARABIC WAVY HAMZA BELOW
.replaceAll('\u0670', '') //ARABIC LETTER SUPERSCRIPT ALEF
//Replace Waw Hamza Above by Waw
.replaceAll('\u0624', '\u0648')
//Replace Ta Marbuta by Ha
.replaceAll('\u0629', '\u0647')
//Replace Ya
// and Ya Hamza Above by Alif Maksura
.replaceAll('\u064A', '\u0649')
.replaceAll('\u0626', '\u0649')
// Replace Alifs with Hamza Above/Below
// and with Madda Above by Alif
.replaceAll('\u0622', '\u0627')
.replaceAll('\u0623', '\u0627')
.replaceAll('\u0625', '\u0627');
关于dart - 如何检查字符串是否包含阿拉伯字符dart flutter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54021892/
我在 mysql 数据库中有一个“价格”字段,其中包含以阿拉伯或波斯数字表示的产品价格。 数字示例:12345567890 //1234567890 我不知道如何格式化它以便以用户友好的方式格式化。我
由于单独使用 prawn gem 时阿拉伯字母显示为未知字符,因此我安装了 Arabic-Prawn gem 0.0.1 以阿拉伯语打印数据。我用下面的代码作为测试 Prawn::Document.g
我是一名优秀的程序员,十分优秀!