본문 바로가기

DEV/ASP.NET

[C#]숫자 콤마 찍기

소스

int currency= 123456890;
Console.WriteLine(string.Format("{0:n0}", currency));
Console.WriteLine(string.Format("{0}", currency.ToString("n0"))); ;
Console.WriteLine(string.Format("{0:#,##0}", currency));
Console.WriteLine(string.Format("{0}", currency.ToString("#,##0")));


실행결과

//결과
//123,456,890
//123,456,890
//123,456,890
//123,456,890


반응형

'DEV > ASP.NET' 카테고리의 다른 글