Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How vb Converts Byte Array into String (Compatible with Chinese and English)
How vb Converts Byte Array into String (Compatible with Chinese and English)
Depending on the source, if the byte array data itself is generated by vb, the method is relatively simple.

Darken s as a string

S = "People of China * * People's Republic of China (PRC)"

Dim b () is a byte.

B = s' directly assigns a byte array, and each character occupies two bytes.

Debugging. Print UBound(b)

Debugging. Print CStr(b)' array conversion string is also very simple.

B = StrConv(s, vbFromUnicode)' is first converted into a compact string and assigned to an array (English letters only take up one byte).

Debugging. Print UBound(b)

Debugging. Print StrConv(b, vbUnicode)' array as a double-byte string.