how can I find type of characters?

This is a discussion on how can I find type of characters? within the C# Programming forums, part of the General Programming Boards category; Hi. I am working on a program that works with words. one of the variables can be filled by both ...

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    177

    how can I find type of characters?

    Hi.
    I am working on a program that works with words.
    one of the variables can be filled by both english characters and arabic characters(the data base that I have to use has a mix of english and arabic words without any separation)!

    for example
    Code:
    string a;
    a="hello";
    a="سلام";
    is there any way to check if the variable has been filed with english characters or arabic characters?

    thank you
    arian

  2. #2
    Registered User
    Join Date
    Nov 2003
    Posts
    177
    I found one way:
    using of the asci code of 'a' and 'z'
    Code:
    string str;
    if ( str.substring(0,1).to lower() < zAsciCode && str.substring(0,1).to lower()> aAscicode)
        it is an english word
    else
        it is an arabic word
    is there a better way?

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I doubt that there is any much better way.

    You can probably find out the range of arabic characters as well, so that if the string is neither arabic nor english, you can identify that this is the case.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 11:17 AM
  2. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  3. Question on l-values.
    By Hulag in forum C++ Programming
    Replies: 6
    Last Post: 10-13-2005, 05:33 PM
  4. ras.h errors
    By Trent_Easton in forum Windows Programming
    Replies: 8
    Last Post: 07-15-2005, 11:52 PM
  5. Won't Return pointer, i can't find why...
    By ss3x in forum C++ Programming
    Replies: 2
    Last Post: 02-28-2002, 08:50 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21