Real to String in X++

hello everyone,

I need to convert float (real) to string, the function needs as a parameter how many number after the smi-column, do you have any ideas?

Thank you

Hi widad,

this code will help you …

str a;

int b;

;

b = real2int(24.23);

a = int2str(b);

info(a);

hi,

http://msdn.microsoft.com/en-us/library/aa632145.aspx

this might help you…

use the function as:

num2Str( real number, int character, int decimals, int separator1, int separator2);

for more information refer to

http://msdn.microsoft.com/en-us/library/aa866120.aspx

hello everyone,

it seems that you didn’t undestand the issue, i need to convert real to string without knowing the number of decimals after the coma, to do this dynamically, here is a solution:

System.Double netDouble;
anytype r1 = 1.125;
str s1;

netDouble = Global::real2double(r1);

s1 = netDouble.ToString();

info(strFmt("%1",s1));

best regards