Main Site Documentation

Convert byte[] to string


#1

I know this is probably super simple but I am struggling ( I swear I have figured this out once before).

Tried scouring APIs and google.

For some reason the code goes into in infinite loop of nothingness when I do:

string buffer = BitConverter.ToString(buffer,0)


#2

nevermind I finally found my old code:

char[] temp = Encoding.UFT8.GetChars(buffer);
string received = new string(temp);


#3

Visual basic has many great string utilities. Another option is to create a class library an call the high level functions from your code.

Example:
'Convert the byte to string
Return ChrW(Data(0)).ToString


#4

This was in C#


#5

C sharp class libraries can be used in vb and vb libraries can be used in C sharp. I think each language has its strong points and weak points :smile:


#6

Do not forget the
Standard Numeric Format Strings

https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#table