News
  • Favorite
  • Facebook
  • Twitter
  • LinkedIn

Microsoft Press Pearson Education (InformIT)
Skip Navigation Links
Pearson Education (InformIT)
How to: Check that a string contains Arabic Characters using C#

Sometimes your application may need to know if a string contains Arabic characters for example if you create an application that sends SMS messages, you need to know the language of the message to handle payment and the length of SMS message differ from Arabic and English messages. You can do that by using the following utility helper method:
 

internal static bool ContainsArabicLetters(string text)

{

    foreach (char character in text.ToCharArray())

    {

        if (character >= 0x600 && character <= 0x6ff)

            return true;

 

        if (character >= 0x750 && character <= 0x77f)

            return true;

 

        if (character >= 0xfb50 && character <= 0xfc3f)

            return true;

 

        if (character >= 0xfe70 && character <= 0xfefc)

            return true;

    }

 

    return false;

} 

There is a way to check that a string contains Arabic characters with regular expressions as in the following method:

internal bool HasArabicCharacters(string text)

{

    Regex regex = new Regex(

        "[\u0600-\u06ff]|[\u0750-\u077f]|[\ufb50-\ufc3f]|[\ufe70-\ufefc]");

    return regex.IsMatch(text);

} 

This method simply checks that every character in the input text falls in the Unicode Character Code of Arabic characters. You can find all Arabic Unicode Character Codes in the following link http://www.unicode.org/charts/

(191) Comments

Blog Message https://micahhaley.yolasite.com/

I think other website proprietors should take this website as an model, very clean and excellent user friendly style and design, let alone the content. You are an expert in this topic!


Blog Message http://vestawoodcock.amoblog.com/discover-the-best-website-to-purchase-fake-money-10233044

Im thankful for the article.Much thanks again.


Blog Message http://www.seoinvancouver.com/

wonderful post, very informative. I wonder why the other specialists of this sector don at notice this. You must continue your writing. I am confident, you have a huge readers a base already!


Blog Message http://www.seoinvancouver.com/

Louis Vuitton For Sale ??????30????????????????5??????????????? | ????????


Blog Message http://www.seoinvancouver.com/

user in his/her brain that how a user can understand it.


Blog Message http://www.seoinvancouver.com/

This is my first time pay a quick visit at here and i am truly happy to read all at alone place.


Blog Message https://pananger4.footsolutionsblog.net/2018/07/09/indulge-link-pushing-for-quality-backlinks./

There is noticeably a bunch to know about this. I feel you made certain nice points in features also.


Blog Message https://www.prospernoah.com/affiliate-programs-in-nigeria/

Really enjoyed this blog post.Really thank you! Keep writing.


Blog Message http://www.seoinvancouver.com/

Thanks for sharing, this is a fantastic post.Really thank you! Cool.


Blog Message http://www.seoinvancouver.com/

You have observed very interesting points ! ps decent internet site. The appearance of right oft leads us wrong. by Horace.


Blog Message http://www.seoinvancouver.com/

Just what I was searching for, thanks for posting.


Blog Message http://www.seoinvancouver.com/

Wow! This can be one particular of the most useful blogs We have ever arrive across on this subject. Actually Great. I am also an expert in this topic so I can understand your hard work.


Blog Message http://opalclumpnerrgs.trekcommunity.com/works-defend-his-dads-legacy-if-the-father-is-himself-a-son-of-a-bitch

It as really a cool and useful piece of information. I am glad that you shared this helpful information with us. Please keep us informed like this. Thanks for sharing.


Blog Message https://www.youtube.com/watch?v=2C609DfIu74

Major thankies for the blog.Really thank you! Fantastic.


Blog Message http://www.seoinvancouver.com/index.php/seo-services/seo-canada

Really enjoyed this article post.Really thank you! Great.

First Previous 1 2 3 4 5 6 7 8 9 10  ... Next Last 
Rating
Name
Email
Comment