is there a way of formatting a string to show whole numbers of a decimal number if it follows 00.
example show 10 if number is 10.00. but show 10.2 if number is 10.2
this is for c#, asp.net
From stackoverflow
-
In .NET:
if (Math.Floor(d) == d) return d.ToString("0"); else return d.ToString();
-
Of course there is:
(if (!= 0 (- (string-to-number x) (floor (string-to-number x)))) (number-to-string (string-to-number x)) x)
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.