Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3437018
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:00:49+00:00 2026-05-18T08:00:49+00:00

What is a good way to tell whether a string contains text in a

  • 0

What is a good way to tell whether a string contains text in a Right To Left language.

I have found this question which suggests the following approach:

public bool IsArabic(string strCompare)
{
  char[] chars = strCompare.ToCharArray();
  foreach (char ch in chars)
    if (ch >= '\u0627' && ch <= '\u0649') return true;
  return false;
}

While this may work for Arabic this doesn’t seem to cover other RTL languages such as Hebrew. Is there a generic way to know that a particular character belongs to a RTL language?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:00:50+00:00Added an answer on May 18, 2026 at 8:00 am

    Unicode characters have different properties associated with them. These properties cannot be derived from the code point; you need a table that tells you if a character has a certain property or not.

    You are interested in characters with bidirectional property “R” or “AL” (RandALCat).

    A RandALCat character is a character with unambiguously right-to-left directionality.

    Here’s the complete list as of Unicode 3.2 (from RFC 3454):

    D. Bidirectional tables
    
    D.1 Characters with bidirectional property "R" or "AL"
    
    ----- Start Table D.1 -----
    05BE
    05C0
    05C3
    05D0-05EA
    05F0-05F4
    061B
    061F
    0621-063A
    0640-064A
    066D-066F
    0671-06D5
    06DD
    06E5-06E6
    06FA-06FE
    0700-070D
    0710
    0712-072C
    0780-07A5
    07B1
    200F
    FB1D
    FB1F-FB28
    FB2A-FB36
    FB38-FB3C
    FB3E
    FB40-FB41
    FB43-FB44
    FB46-FBB1
    FBD3-FD3D
    FD50-FD8F
    FD92-FDC7
    FDF0-FDFC
    FE70-FE74
    FE76-FEFC
    ----- End Table D.1 -----
    

    Here’s some code to get the complete list as of Unicode 6.0:

    var url = "http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt";
    
    var query = from record in new WebClient().DownloadString(url).Split('\n')
                where !string.IsNullOrEmpty(record)
                let properties = record.Split(';')
                where properties[4] == "R" || properties[4] == "AL"
                select int.Parse(properties[0], NumberStyles.AllowHexSpecifier);
    
    foreach (var codepoint in query)
    {
        Console.WriteLine(codepoint.ToString("X4"));
    }
    

    Note that these values are Unicode code points. Strings in C#/.NET are UTF-16 encoded and need to be converted to Unicode code points first (see Char.ConvertToUtf32). Here’s a method that checks if a string contains at least one RandALCat character:

    static void IsAnyCharacterRightToLeft(string s)
    {
        for (var i = 0; i < s.Length; i += char.IsSurrogatePair(s, i) ? 2 : 1)
        {
            var codepoint = char.ConvertToUtf32(s, i);
            if (IsRandALCat(codepoint))
            {
                return true;
            }
        }
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a good way for displaying unicode text in opengl under Windows? For
Does anyone have a good way to build MSI (vdproj) projects using MsBuild or
Is there a good way to find out which exceptions a procedure/function can raise
Is there any good way to deal with the class renaming refactor from Resharper
What is a good way to remove the code from display pages when developing
Is there a good way to create a form in VB6 that can easily
What is a good way to perform animation using .NET? I would prefer not
Is there a good way to see what format an image is, without having
What is a good way to render data produced by a Java process in
Is there a good way to time SQL queries when using Linq to SQL?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.