Posted By

rtipton on 06/07/09


Tagged

decimal csharp


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Strip Decimal and Zero Fill


 / Published in: C#
 

  1. using System;
  2. namespace StripDecimal_CS
  3. {
  4. class RemoveDecimal
  5. {
  6. static void Main(string[] args)
  7. {
  8. double testNum = 255.95;
  9. string noDecimalVal = testNum.ToString().Replace(".", "").PadLeft(9, '0');
  10.  
  11. Console.WriteLine("Original Value: " + testNum.ToString());
  12. Console.WriteLine("Value w/No Decimal: " + noDecimalVal);
  13. }
  14. }
  15. }

Report this snippet  

You need to login to post a comment.