[Solved] Put Space between numbers in C# [closed]


string num = "42339";
string result = String.Join("   ", num.Select(c=>c));

EDIT:
This part is just for fun, I collected some alternatives from comments and also added a few

string numstr = "42339";

string result = String.Join("   ", numstr.Select(c => c));
string result = String.Join("   ", (IEnumerable<char>) numstr);
string result = String.Join("   ", numstr.AsEnumerable());
string result = String.Join("   ", numstr.ToArray());
string result = String.Join("   ", numstr.ToCharArray());

string result = String.Join("   ", numstr.Where((_) => true));
string result = String.Join("   ", numstr.Where(char.IsDigit));
string result = String.Join("   ", numstr.Select(char.ToLower));

string result = string.Join("   ", Regex.Split(numstr, "")).Trim();
string result = numstr.Aggregate("", (s, c) => s += c + "   ").Trim();

string result = Regex.Replace(numstr, ".", m => m.Value + "   ").Trim();
string result = Regex.Replace(numstr, ".", "$0   ").Trim();
string result = Regex.Replace(numstr, "[^.]{0}", "   ").Trim();

9

solved Put Space between numbers in C# [closed]