Created
August 27, 2018 05:33
-
-
Save donma/83f5ad8770f9cc5170f2144113f83ded to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GetMoneyString(decimal number) | |
{ | |
if (number.ToString().Contains(".")) | |
{ | |
var format = "#,###,###,####."; | |
var tmpDot = number.ToString().Split('.')[1]; | |
for (var i = 0; i < tmpDot.Length; i++) { | |
format += "#"; | |
} | |
return number.ToString(format); | |
} | |
else { | |
return number.ToString("#,###,###,####"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment