string ConverCounter(String NUmber) { //String[] characters = Label1.Text.ToArray(); int i = 1; String OutPut = ""; int Length = NUmber.ToCharArray().Length; String TExt = NUmber; char[] Textnew = NUmber.ToCharArray(); if (Length <= 3) { OutPut = TExt; } else { if (Length % 3 == 1) {TExt=""; string Dividparts = ""; for (int j = 1; j < Textnew.Length; j++) { TExt += Textnew[j].ToString(); } //DevidTextinto 3Parts foreach (char c in TExt) { if (i % 3 == 0) Dividparts += c + " "; else Dividparts += c; i++; } OutPut = Textnew[0].ToString() + " " + Dividparts; ; } else if (Length % 3 == 2) { TExt = ""; string Dividparts = ""; for (int j = 2; j < Textnew.Length; j++) { TExt += Textnew[j].ToString(); } foreach (char c in TExt) { if (i % 3 == 0) Dividparts += c + " "; else Dividparts += c; i++; } foreach (char c in TExt) { if (i % 3 == 0) OutPut += c + " "; else OutPut += c; i++; } OutPut = Textnew[0].ToString() + Textnew[1].ToString() + " " + Dividparts; } else if (Length % 3 == 0) { string Dividparts = ""; foreach (char c in TExt) { if (i % 3 == 0) Dividparts += c + " "; else Dividparts += c; i++; } OutPut = Dividparts; } } //if (Length == 4) //{ // Length = 5; // TExt = " "+" " + TExt; //} //if (Length == 5) //{ // Length = 6; // TExt = " " + TExt; //} //if (Length == 7) //{ // Length = 8; // TExt = " "+" "+ TExt; //} ////if (Length % 3 != 0) ////{ //// TExt = " " + Label1.Text; ////} //foreach (char c in TExt) //{ // if (i % 3 == 0) // OutPut += c + " "; // else // OutPut += c; // i++; //} return OutPut; }