How do I know if a character is a given language? Unicode line

Possible duplicate:
Return the language of the given string

The task is to sort the list of strings. Priority in a specific language. Strings can be written in different languages. For example, Chinese, English, Russian. And I need to take all the Chinese first, and then the rest.

To do this, I want to know which country (language) belongs to a certain character in the string. (For example, on the first letter)

Are there any classes or methods?

+5
source share
2 answers

If we are talking about alphabets, you can simply check the int representation of char by doing it:

int unicodeValue = (int)myString[0];

, , ​​ , , .
, 19984, 4E10 (19984.ToString("X")), CJK. , , .

, , , Soundex.

+3

?

()

var text = "¿Dónde está el baño?";
google.language.detect(text, function(result) {
if (!result.error) {
var language = 'unknown';
for (l in google.language.Languages) {
  if (google.language.Languages[l] == result.language) {
    language = l;
    break;
  }
}
var container = document.getElementById("detection");
container.innerHTML = text + " is: " + language + "";
}
});
+1

All Articles