You can do:
double decimalNumber = 123.456; var numbersBeforeDecimalPoint = Math.Truncate(decimalNumber); var numbersAfterDecimalPoint = decimalNumber - numbersBeforeDecimalPoint;
Using Math.Truncate , we can only get integers, and we can use this in tandem with our original number to get the decimal part.
As a result, you get 123 and 0.456 .
Not sure if this is exactly what you need (I appreciate that you might want 123 and 456 ). There are many good suggestions here for string manipulation if you need more precise formatting.
user1105802
source share