Furkan Gözükara
Furkan Gözükara

Reputation: 23830

How to remove TASHKEEL / HARAKAT from given Arabic string in C#

I want to remove the following TASHKEEL / HARAKAT from any given Arabic string without removing letters

How can i do that?

C# .net 4.6.2

enter image description here

Upvotes: 0

Views: 2986

Answers (2)

mtesta010
mtesta010

Reputation: 103

try this

      str= str.Replace("\u064b", "");
        str= str.Replace("\u064f", "");
        str= str.Replace("\u064c", "");
        str= str.Replace("\u0652", "");
        str= str.Replace("\u064d", "");
        str= str.Replace("\u0650", "");
        str= str.Replace("\u0651", "");
        str= str.Replace("\u064e", "");

Upvotes: 1

Taha Paksu
Taha Paksu

Reputation: 15616

Example string taken from other question,

string str = "الْحَمْدُ لِلَّهِ رَبِّ الْعَالَمِينَ";

// to be replaced characters
char[] tashkeel = new char[]{'ِ', 'ُ', 'ٓ', 'ٰ', 'ْ', 'ٌ', 'ٍ', 'ً', 'ّ', 'َ'};

// doing the replacement
foreach(char c in tashkeel)
    str = str.Replace(c.ToString(),"");

MessageBox.Show(str);

Upvotes: 4

Related Questions