Giter Club home page Giter Club logo

Comments (5)

MohHeader avatar MohHeader commented on September 4, 2024
	internal static string RemoveTashkeel(string str, out List<TashkeelLocation> tashkeelLocation)
	{
		tashkeelLocation = new List<TashkeelLocation>();
		char[] letters = str.ToCharArray();

		int index = 0;
		for (int i = 0; i < letters.Length; i++) {
			if (letters [i] == (char)0x064B) { // Tanween Fatha
				tashkeelLocation.Add (new TashkeelLocation ((char)0x064B, i));
				index++;
			} else if (letters [i] == (char)0x064C) { // DAMMATAN
				tashkeelLocation.Add (new TashkeelLocation ((char)0x064C, i));
				index++;
			} else if (letters [i] == (char)0x064D){ // KASRATAN
				tashkeelLocation.Add (new TashkeelLocation ((char)0x064D, i));
				index++;
			}else if (letters [i] == (char)0x064E) { // FATHA
				if(index > 0)
				{
					if(tashkeelLocation[index-1].tashkeel == (char)0x0651 ) // SHADDA
					{
						tashkeelLocation [index - 1].tashkeel = (char)0xFC60; // Shadda With Fatha
						continue;
					}
				}

				tashkeelLocation.Add (new TashkeelLocation ((char)0x064E, i));
				index++;
			} else if (letters [i] == (char)0x064F) { // DAMMA
				if (index > 0) {
					if (tashkeelLocation [index - 1].tashkeel == (char)0x0651) { // SHADDA
						tashkeelLocation [index - 1].tashkeel = (char)0xFC61; // Shadda With DAMMA
						continue;
					}
				}
				tashkeelLocation.Add (new TashkeelLocation ((char)0x064F, i));
				index++;
			} else if (letters [i] == (char)0x0650) { // KASRA
				if (index > 0) {
					if (tashkeelLocation [index - 1].tashkeel == (char)0x0651) { // SHADDA
						tashkeelLocation [index - 1].tashkeel = (char)0xFC62; // Shadda With KASRA
						continue;
					}
				}
				tashkeelLocation.Add (new TashkeelLocation ((char)0x0650, i));
				index++;
			} else if (letters [i] == (char)0x0651) { // SHADDA
				if(index > 0)
				{
					if(tashkeelLocation[index-1].tashkeel == (char)0x064E ) // FATHA
					{
						tashkeelLocation [index - 1].tashkeel = (char)0xFC60; // Shadda With Fatha
						continue;
					}

					if(tashkeelLocation[index-1].tashkeel == (char)0x064F ) // DAMMA
					{
						tashkeelLocation [index - 1].tashkeel = (char)0xFC61; // Shadda With DAMMA
						continue;
					}

					if(tashkeelLocation[index-1].tashkeel == (char)0x0650 ) // KASRA
					{
						tashkeelLocation [index - 1].tashkeel = (char)0xFC62; // Shadda With KASRA
						continue;
					}
				}

				tashkeelLocation.Add (new TashkeelLocation ((char)0x0651, i));
				index++;
			} else if (letters [i] == (char)0x0652) { // SUKUN
				tashkeelLocation.Add (new TashkeelLocation ((char)0x0652, i));
				index++;
			} else if (letters [i] == (char)0x0653) { // MADDAH ABOVE
				tashkeelLocation.Add (new TashkeelLocation ((char)0x0653, i));
				index++;
			}
		}

		string[] split = str.Split(new char[]{(char)0x064B,(char)0x064C,(char)0x064D,
			(char)0x064E,(char)0x064F,(char)0x0650,
			(char)0x0651,(char)0x0652,(char)0x0653,(char)0xFC60,(char)0xFC61,(char)0xFC62});

		str = "";

		foreach(string s in split)
		{
			str += s;
		}

		return str;
	}

from arabic-support-unity.

Konash avatar Konash commented on September 4, 2024

Is that the solution?
I would recommend a merge if so.

from arabic-support-unity.

MohHeader avatar MohHeader commented on September 4, 2024

It is working ( at least for me ),,,
Will create a merge request, 👍

from arabic-support-unity.

MohHeader avatar MohHeader commented on September 4, 2024

#11

from arabic-support-unity.

Konash avatar Konash commented on September 4, 2024

from arabic-support-unity.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.