How to use C # to detect the actual length of a string containing Chinese characters
This article is about how to use C # to detect the actual length of Chinese strings. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The code is as follows:
ASCIIEncoding n = new ASCIIEncoding (); byte [] b = n.GetBytes (str); int l = 0; / / l is the actual length of the string for (int item0)