Reputation:
I want to take a number with a decimal point and add the numbers after the point to the integer number.
For example:
input: 1.88
Output: 188
Not specifically working with 2 decimal numbers
Thanks.
Upvotes: 1
Views: 157
Reputation: 17964
As suggested by kosist:
double input = 1.88;
var inputAsString = input.ToString(CultureInfo.InvariantCulture);
var output = inputAsString.Replace(".", "");
//Optional:
var outputAsInt = int.Parse(output);
Upvotes: 2