Created
January 22, 2013 16:22
-
-
Save jerone/4595989 to your computer and use it in GitHub Desktop.
Insert char at index in char array (in this case a number)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Windows.Forms; | |
namespace Script | |
{ | |
public class Script | |
{ | |
public void Main() | |
{ | |
int no = 52123456; | |
char[] c = no.ToString().ToCharArray(); | |
char[] buffer = new char[c.Length + 1]; | |
for (int i = 0, ii = 0; i < c.Length; i++) | |
{ | |
if (i == 2) | |
{ | |
buffer[i] = '.'; | |
} | |
else | |
{ | |
buffer[i] = c[ii]; | |
ii++; | |
} | |
} | |
String result = new String(buffer); | |
MessageBox.Show(result); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment