Determine whether the text is in Chinese or English
2017-09-22 15:05
435 查看
public bool IsChineseCharacter (string str) { Regex regChina = new Regex ("^[^\x00-\xFF]"); Regex regEnglish = new Regex ("^[a-zA-Z]"); if (regEnglish.IsMatch (str)) { return false; } else if (regChina.IsMatch (str)) { return true; } else { return false; } //byte [] byte_len = System.Text.Encoding.Default.GetBytes (ch); //if (byte_len.Length == 2) { return true; } }
相关文章推荐
- Determine whether the concatenation of a and b in this order is a square number.
- How To Check Whether Physical Standby is in Sync with the Primary or Not?
- Determine whether the product of a and b is even or odd.
- The DCOM settings which are independent of whether the PC is in a work group or in a domain
- The input character is not valid in MATLAB statements or expressions.
- VS2010 The project file ' ' has been renamed or is no longer in the solution
- android 的The method makeText(Context, CharSequence, int) in the type Toast is not applicable fo(
- What is the diference between putting a property on application.yml or bootstrap.yml in spring boot?
- [BTS] Loading property information list by namespace failed or property not found in the list. Verify that the schema is deployed properly.
- 无法打开Eclipse:The default workspace “xxx” is in use or cannot be created Please choose a different one
- 设置TextBox中光标的位置到最后(set the cursor position in a TextBox or InputText)
- sql --it is not contained in either an aggregate function or the GROUP BY clause.
- SQL Server: Text was truncated or one or more characters had no match in the target code page error
- 异常-----Can't convert the date to string, because it is not known which parts of the date variable are in use. Use ?date, ?time or ?datetime built-in, or ?string.\u003Cformat> or ?string(format) built-
- The URL "filename" is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web
- SQL SERVER – Fix: Error Msg 128 The name is not permitted in this context. Only constants, expressions, or variables allowed her
- 解决Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in
- 解决mysql_connect(): The mysql extension is deprecated and will beremoved in the future: use mysqli or
- [Thought]What is the vital thing on the Internet or in real world?
- eclipse提示“the default workspace "D:/*****"is in use or cannot be created.Please choose a different”