Mega Code Archive

 
Categories / C# / Data Types
 

Custom number format

using System; public class MainClass {     public static void Main()     {         double posValue = 1234;         double negValue = -1234;         double zeroValue = 0;         string fmt2 = "##;(##)";         string fmt3 = "##;(##);**AAA**";         Console.WriteLine(posValue.ToString(fmt2));         Console.WriteLine(negValue.ToString(fmt2));         Console.WriteLine(zeroValue.ToString(fmt3));     } } /* 1234 (1234) **AAA** */