Return to Snippet

Revision: 14617
at June 7, 2009 19:35 by rtipton


Updated Code
using System;
namespace StripDecimal_CS
{
    class RemoveDecimal
    {
        static void Main(string[] args)
        {
            double testNum = 255.95;
            string noDecimalVal = testNum.ToString().Replace(".", "").PadLeft(9, '0');

            Console.WriteLine("Original Value: " + testNum.ToString());
            Console.WriteLine("Value w/No Decimal: " + noDecimalVal);
        }
    }
}

Revision: 14616
at June 7, 2009 19:27 by rtipton


Initial Code
using System;
namespace StripDecimal_CS
{
    class RemoveDecimal
    {
        static void Main(string[] args)
        {
            double testNum = 255.95;
            string noDecimalVal = testNum.ToString().Replace(".", "").PadLeft(9, '0');

            Console.WriteLine(noDecimalVal);
        }
    }
}

Initial URL

                                

Initial Description

                                

Initial Title
Strip Decimal and Zero Fill

Initial Tags

                                

Initial Language
C#