123456789101112131415161718192021222324 |
-
- namespace MySystem
- {
- public class PublicFunction
- {
- public static decimal NumberFormat(decimal number, int floatCount = 2)
- {
- string str = number.ToString();
- if (str.Contains("."))
- {
- string[] list = str.Split('.');
- if (list[1].Length > 2)
- {
- str = list[0] + "." + list[1].Substring(0, 2);
- }
- }
- else
- {
- str += ".00";
- }
- return decimal.Parse(str);
- }
- }
- }
|