Stefantastisk wrote:
Hey there,
Anyone knows a clever method for knowing the length of the digit after
a decimal point in a standard C# decimal value, WITHOUT use of any
string formatting.
Example:
5231,12231 <- Lengt = 5
Tnx for your attention hope you are capable of helping.
Kind regards
Stefan
It's *intrinsically* a string issue. As far as numbers/math is
concerned, *every* decimal (i.e. every real number) has the same number
of digits to the right of the decimal point: a countable infinity of
them.
The only way to get a different count is to consider the number as a
string, and apply some convention or another. E.g., there could
hypothetically be a culture somewhere whose practice is to never write
a number whose rightmost digit is '7'. This of course doesn't result in
the loss of any numerical expressive capability, but it *does* change
the count you're talking about. (Just to highlight the fact that both
strings and conventions are the heart of the matter here.)