Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use C # to detect the actual length of a string containing Chinese characters

Shulou Source: shulou.com Published: 2022-06-03 16:35:26 11月14日 Update

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)

Tags: Characters strings actual length cashes Chinese detection content more articles good practical code articles see knowledge symbols Chinese characters references help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Linux Docker vpn Shulou Information