Page 1 of 1

separate a no.

Posted: 31 Jan 2014 14:07
by apshergill91
How do i split a decimal no [15.23] into its decimal and non-decimal part(i.e. 0.23 & 15 resp.)

REGARDS.

Re: separate a no.

Posted: 31 Jan 2014 18:04
by Martin
Hi,

You could use following script:

Code: Select all

number = 15.23;
n = "{number,numberformat,0}";//to format the number --> "15"
d = number - n;//15.23 - 15 --> 0.23
or

Code: Select all

number = 15.23;
d = number % 1;//modulo division by 1 --> 0.23
n = number - d;//--> 15.0 
Regards,
Martin