I won’t say much nonsense, I will just post the code to you. The specific code is as follows:
using System; using ; using ; using ; using ; using ; namespace Regular expression01 { /// <summary> /// Is it Chinese? /// </summary> class Program { /// <summary> /// In the ASCII code table, the range of English is 0-127, while the Chinese characters are greater than 127 /// </summary> static void justice1() { string text = "adonai, the heroes of the world come out of us, and as soon as we enter the world, we are urging us. The world is full of overlordship and chatting and laughing, and life is drunk. Holding a sword and crossing a cavalry and wielding a ghost rain, the bones are astonished as mountain birds. The world is like a trendy man like water, and I only sigh that a few people in the world return."; for (int i = 0; i < ; i++) { if ((int)text[i] > 127) ("It's Chinese characters"); else ("Not Chinese characters"); } } /// <summary> /// The UNICODE encoding range of Chinese characters is 4e00-9fbb /// </summary> static void justice2() { string text = "adonai, the heroes of the world come out of us, and as soon as we enter the world, we are urging us. The world is full of overlordship and chatting and laughing, and life is drunk. Holding a sword and crossing a cavalry and wielding a ghost rain, the bones are astonished as mountain birds. The world is like a trendy man like water, and I only sigh that a few people in the world return."; char[] c = (); for (int i = 0; i < ; i++) if (c[i] >= 0x4e00 && c[i] <= 0x9fbb) ("It's Chinese characters"); else ("Not Chinese characters"); } /// <summary> /// Regular expression judgment is also used to use the UNICODE encoding range of Chinese characters. /// </summary> static void justice3() { string text = "adonai, the heroes of the world come out of us, and as soon as we enter the world, we are urging us. The world is full of overlordship and chatting and laughing, and life is drunk. Holding a sword and crossing a cavalry and wielding a ghost rain, the bones are astonished as mountain birds. The world is like a trendy man like water, and I only sigh that a few people in the world return."; for (int i = 0; i < ; i++) { if ((text[i].ToString(), @"[\u4e00-\u9fbb]")) ("It's Chinese characters"); else ("Not Chinese characters"); } } static void Main(string[] args) { justice1(); (); } } }
The above is the editor’s introduction to verify Chinese characters using C# regular expressions. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to everyone in time. Thank you very much for your support for my website!