I have a string of 4 numbers:
1234
I want to convert this in the most elegant way possible in MVC to
1,2,3,4
codeToSend.ToString("#,#");
but this outputs "1,234" (which I expected really).
I suspected that the following would put a comma after every digit, but to no avail.
codeToSend.ToString("#,#,#,#");
I have also tried string.format, but again I am facing the same issue.
var formattedString = string.Format("{0:0,0}", 1234);
Whats the most efficient way of doing this therefore?
Note: The string of numbers will always be 4 digits long - and numbers only. I don't want to use Insert as this wouldn't be very elegant IMO and I am aware this question has been asked before in similar ways but it is always slightly different in crucial ways (such as formatting to thousands, not every digit or just not elegantly!).