Wednesday 10 September 2014

Break decimal value into two values (before and after decimal)

double value = 2635.215;
int firstValue = 2635; // willbe
int secondValue = 215; // will be


double value = 2635.215;
    string a = value.ToString();
    string[] b =a.Split('.');
    int firstValue= int.Parse(b[0]);
    int secondValue= int.Parse(b[1]);

No comments:

Post a Comment