array<Byte> ^RxData = gcnew array<Byte>(2);
	RxData[0] = 'A';
	RxData[0] = 'B';
	String ^sTemp;

	sTemp = System::Text::Encoding::UTF8->GetString(RxData);

N.B. Make the array the length of the string – do not use a 0x00 terminating byte. If you do you get a resulting string but you can't add any new characters to it (e.g. MyString += "abc") because the null has been taken into it. You can use this to remove them:

	sTemp = sTemp->Replace("\0", "");

Converting A Single Char / Byte

	Byte Value = 0x31;
	SomeString += (Char)Value;		//<<Note the capital C

Alternative method - convert it to an array (a silly solution but it works!)

	array<Byte> ^ch = gcnew array<Byte>(1);
	ch[0] = Convert::ToByte(SomeString[i]);
	SomeString += System::Text::Encoding::UTF8->GetString(ch);

Removing Nulls In A String

	SomeString = SomeString->Replace("\0", "");
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


Your email address will not be published.