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/

(269) Comments

Blog Message https://www.furnimob.com

Lovely site! I am loving it!! Will come back again. I am bookmarking your feeds also


Blog Message https://www.navy-net.co.uk/rrpedia/How_To_Store_For_A_Auto_And_Defend_You..._Advice_Num_36_Of_50

the time to study or take a look at the subject material or internet sites we ave linked to beneath the


Blog Message http://thecase.org/having-a-sound-device-knowledge/

the same nearly very often inside case you shield this increase.


Blog Message http://despertandomispensrrb.savingsdaily.com/roof-costs-25000-to-replace-and-lasts-for-persons-as-it-relates-to-the-usage-of-the-property-once-purchased

Very informative article post.Thanks Again. Really Cool.


Blog Message http://gpmortgaged9e.wickforce.com/do-they-have-beds-in-covered-cute-and-classy-frozen-party

Major thankies for the blog.Thanks Again. Want more.


Blog Message http://adgainersolutions.com/adgainer/index.php/incomingdata/PPCserver?AGurl=http://url.ie/site/changes/

Thanks for the post.Really thank you! Awesome.


Blog Message http://viktormliscu.biznewsselect.com/these-oven-mitts-will-help-protect-your-hands-from-dangerous-damage-or-fade-rug

Usually I do not learn article on blogs, but I wish to say that this write-up very pressured me to try and do it! Your writing style has been surprised me. Thank you, very great article.


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

Keep up the superb piece of work, I read few articles on this web site and I think that your web blog is very interesting and has got sets of great info.


Blog Message https://wibergcummings2784.page.tl/Cost_free-Apk-Entire-Download-Available-for-Personal-computer-Windows-7%2C8%2C10%2CXP.htm?forceVersion=desktop

This is very interesting, You are a very skilled blogger. I have joined your feed and look forward to seeking more of your fantastic post. Also, I ave shared your site in my social networks!


Blog Message http://thefinancialmetrics.com/news/cookie-s-kids-children-school-uniform-fashion-trends-for-2019/144388/

Very good article post.Much thanks again. Want more.


Blog Message https://en.gravatar.com/hake167

Very nice article. I certainly appreciate this website. Continue the good work. Thanks!


Blog Message http://eliteweb.bravesites.com/

Thank which you bunch with regard to sharing this kind of with all you genuinely admit a minute ago what you are speaking approximately! Bookmarked. Entertain also obtain guidance from my web page


Blog Message http://normand1401kj.journalwebdir.com/asset-classes-a-group-of-assets-significant-reduction-to-the-corporate-tax-rate-and-a-reduction-in-most-individual-tax-rates

It'а†s in point of fact a nice and helpful piece of info. I am glad that you shared this helpful info with us. Please stay us up to date like this. Thanks for sharing.


Blog Message http://xn--b1adccaenc8bealnk.com/users/lyncEnlix979

That is a good tip particularly to those fresh to the blogosphere. Brief but very accurate info Thanks for sharing this one. A must read post!


Blog Message http://up.result-nic.in/

Wow! This could be one particular of the most helpful blogs We have ever arrive across on this subject. Basically Fantastic. I am also a specialist in this topic so I can understand your hard work.

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