Thursday, August 13, 2009

doubleToString

SDBString_ptr SDBUtil::doubleToString(double number) {
char buffer[64];
sprintf(buffer, "%f", number);

//int count, count2;
for(char* p = buffer + strlen(buffer) - 1; p >= buffer; p--) {
if (*p == '0') {
*p = '\0';
} else {
if (*p == '.') {
*p = '\0';
}
break;
}
}

return new SDBString(buffer);
}