Beispiel #1
0
        private string NumberToFormat(double?value, string format)
        {
            format = format ?? Options.DefaultFormat;
            string output;

            // format based on value
            if (value == 0 && Options.ZeroFormat != null)
            {
                output = Options.ZeroFormat;
            }
            else if (value == null && Options.NullFormat != null)
            {
                output = Options.NullFormat;
            }
            else
            {
                var factory   = new FormatFactory();
                var formatter = factory.GetNumberFormatter(format);
                output = formatter.NumberToFormat(value, format, Options);
            }
            return(output);
        }