public bool ContainsUnicodeCharacter(char[] input)
{
const int MaxAnsiCode = 255;
bool temp;
string s;
foreach (char a in input)
{
s = a.ToString();
temp = s.Any(c => c > MaxAnsiCode);
if (temp == false)
{
return false;
}
}
}
此代碼用於檢查unicode是否存在於輸入字符數組中。包含Unicode字符檢查失敗
我收到錯誤消息: 「ContainsUnicodeCharacter(的char [])」:並非所有的代碼路徑返回一個值「
什麼錯在這裏去了,請幫助。 謝謝。
**所有** .NET'char's是Unicode字符。 – AakashM
那麼's = a.ToString(); temp = s.Any(c => c> MaxAnsiCode);'可以用'temp = a> MaxAnsiCode;'替換。 – Vlad