0

我正在研究 C#

我在数组中有一些值。

Stirng [] values;

数组中的一些值是中文值。

我必须将这些值放入数据库中。在将其放入数据库之前,我想找出哪些值是中文的。

这样我就可以创建正确的 SQLString 来执行

check isChinese(String abc ){
    **Condition for chinese unicode** ???

    return true or false
}

____
if tovalue isChinese == true 
     SqlValue= N +" ' toValue ' "

else
    SqlValue= SqlValue

SqlQuery = SqlQuery + SqlValue
4

2 回答 2

1

关于如何进行字符范围检查的相关问题:有没有办法检查 unicode 文本是否为某种语言?

完整的中文字符集可以在这里找到:Unicode 中中文字符的完整范围是多少?

希望这可以帮助!

于 2013-09-23T15:28:40.063 回答
0

您必须将所有中文字符保存在一个数组中(char[] 或 string[])。

然后调用该函数,并让它检查参数是否在数组中:

if (chineseletters.IndexOf(parameter) >= 0) {
  return "This is a Chinese character!";
} else return "This is not a Chinese character!";
于 2013-09-23T15:23:07.623 回答