How do I detect if a string contains any right to left characters?

I'm trying to create a method to detect strings written from right to left in Java I came up with this question to do something similar in C #

Solution

I came up with the following code:

char[] chars = s.tocharArray();
for(char c: chars){
    if(c >= 0x600 && c <= 0x6ff){
        //Text contains RTL character
        break;
     }
}

It is not a very effective way or an accurate method, but it can give an idea

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>