Monday 15 September 2014

c# - int array to string -


In C #, I have an array of ints that contain only digits, I want to convert this array to a string .

Array's example:

  int [] arr = {0,1,2,3,0,1};  

How can I convert it to formatted string: "012301"?

at.net 3.5 Usage:

  string .join (" ", New list & lt; int & gt; (array). ConvertAll (i = & gt; i.ToString ()) toArray ()).  

Use of at.net 4.0 or above: (see Jane Rimunda's answer)

  string result = string .join ("", Array);  

No comments:

Post a Comment