public static string ShortNiceNumber(decimal number,
                                      bool html = false,
                                      ShowDecimalVal showDecimal = ShowDecimalVal.AsNeeded,
                                      MaxScale exactScale        = MaxScale.Any,
                                      bool hideSuffix            = false)
 {
     return(ShortNicePrice(number, "0", "", html, showDecimal, exactScale, hideSuffix));
 }
        public static string ShortNicePrice(decimal number,
                                            string valueIfZero         = "0 {0}", string mena = "Kč", bool html = false,
                                            ShowDecimalVal showDecimal = ShowDecimalVal.Hide,
                                            MaxScale exactScale        = MaxScale.Any,
                                            bool hideSuffix            = false)
        {
            decimal n = number;

            string suffix;

            if ((n > OneBil && exactScale == MaxScale.Any) || exactScale == MaxScale.Bilion)
            {
                n     /= OneBil;
                suffix = "bil.";
            }
            else if ((n > OneMld && exactScale == MaxScale.Any) || exactScale == MaxScale.Miliarda)
            {
                n     /= OneMld;
                suffix = "mld.";
            }
            else if ((n > OneMil && exactScale == MaxScale.Any) || exactScale == MaxScale.Milion)
            {
                n     /= OneMil;
                suffix = "mil.";
            }
            else if (exactScale == MaxScale.Tisic)
            {
                n     /= OneTh;
                suffix = "";
            }
            else
            {
                suffix = "";
            }

            if (hideSuffix)
            {
                suffix = "";
            }

            string ret = string.Empty;

            string formatString = "{0:### ### ### ### ### ##0} " + suffix + " {1}";

            if (showDecimal == ShowDecimalVal.Show)
            {
                formatString = "{0:### ### ### ### ### ##0.00} " + suffix + " {1}";
            }
            else if (showDecimal == ShowDecimalVal.AsNeeded)
            {
                formatString = "{0:### ### ### ### ### ##0.##} " + suffix + " {1}";
            }


            if (number == 0)
            {
                if (valueIfZero.Contains("{0}"))
                {
                    ret = string.Format(valueIfZero, mena);
                }
                else
                {
                    ret = valueIfZero;
                }
            }
            else
            {
                ret = String.Format(formatString, n, mena).Trim();
            }

            ret = ret.Trim();


            if (html)
            {
                return(String.Format("<span title=\"{2:### ### ### ### ### ##0} {1}\">{0}</span>", ret.Replace(" ", "&nbsp;"), mena, number));
            }
            return(ret);
        }