02.Development/C#
[C#] 숫자 문자열에 컴마(,) 찍기
Dominic.Kim
2016. 2. 12. 09:39
돈 표기처럼,
숫자 문자열에 컴마를 찍어서 출력하는 방법은 정말 간단합니다.
ToString("n0")
하세요!
1 2 3 4 5 6 7 8 9 10 | public static string InsertComma (int n) { return n.ToString("n0"); } int n = 1234567; Console.WriteLine(string.Format("{0}", InsertComma(n))); // 출력결과 : 1,234,567 | cs |