i've got a function that does exactly that. i already posted it before, so if you would have searched a bit you would have found the code to do that... (STFW) void NumFormat(Char *strP, double dvalue, short dec){ Char *buf = MemPtrNew(50); Char *szDec = MemPtrNew(20); Int32 lpow = pow(10, dec); Int32 i = (Int32)dvalue; Int32 d = (dvalue - i) * lpow;
// round the last decimal! UInt8 tmp = (dvalue*lpow*10) - (i*lpow*10); if(tmp > 4) d++; StrIToA(buf, i); if(dec){ if(d < 0) d *= -1; StrIToA(szDec, d); StrCat(buf, ","); for(i = 0; StrLen(szDec) + i < dec; i++) StrCat(buf, "0"); StrCat(buf, szDec); } StrCopy(strP, buf); MemPtrFree(buf); MemPtrFree(szDec); } markus dresch (www.palmside.com) "Régis Daniel de Oliveira" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:110744@palm-dev-forum... > > Hy! > > How can I format a double value to a string like the example bellow? > > a string like this: > > 200 to 200,00 > 235,1 to 235,10 > 2541 to 2.541,00 > > The last one is not very important, but i really need to know how to > transform the doubles values to string like the examples. > > Thanks! > > > > > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/