什么是正确的方法可以把的char []
成字符串?
这是一个字符数组的的ToString()
方法不会做的伎俩。
的char []字符= {'A','','S','T','R' ,'我','N','G'};
字符串s =新的字符串(字);
What is the proper way to turn a char[]
into a string?
The ToString()
method from an array of characters doesn't do the trick.
char[] chars = {'a', ' ', 's', 't', 'r', 'i', 'n', 'g'};
string s = new string(chars);