(1) how to convert char [] and string in C:
String to Char []
String ss = "abcdefg ";
Char [] cc = ss. ToCharArray ();
Char [] to string
String s = new string (cc );
--------------------------------------------------
(2) how to convert byte [] and string in C:
Byte [] to string
Byte [] bb = Encoding. UTF8.GetBytes (ss );
String s = Encoding. UTF8.GetString (bb );
String to byte []
Byte [] bytes;
String str = "abc ";
System. Text. ASCIIEncoding ascill = new ASCIIEncoding ();
Bytes = ascill. GetBytes (str );
(3) returns an integer in reverse order, for example, 987654321 to 123456789.
// Method 1: inverted Loop
Int [] intArray = {9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
For (int I = intArray. Length-1; I> = 0; I --)
{
// IntArray [I];
}
// Method 2: Use the Reverse function Reverse
Int [] newArrary = intArray. Reverse (). ToArray ();
// Method 3: how to convert char [] and string in C:
String strnum= "9876543210 ";
Char [] reversed = strNum. Reverse (). ToArray ();
String newStrNum = new string (reversed );