Tuesday, October 25, 2016

Determine the Size of a String in Bytes


You can use encoding like ASCII to get a character per byte by using the System.Text.Encodingclass.
or try this
  System.Text.ASCIIEncoding.Unicode.GetByteCount(string);
  System.Text.ASCIIEncoding.ASCII.GetByteCount(string);

No comments:
Write comments
Recommended Posts × +