In .NET, I need to convert a decimal amount (money) to a numbers-only string, i.e: 123,456.78 -> 12345678
I thought
var dotPos = amount.ToString().LastIndexOf('.');
var amountString = amount.ToString().Remove(dotPos);
would solve my problem, or at least part of it, but it didn't work as I expected. I'm trying to do this possibly without writing a lot of code and using something already designed for a similar purpose.
"123,456.78".Remove(7)
will yield123,456
. – Poussette