22 for(
unsigned int i=0;i<strToConvert.length();i++)
24 strToConvert[i] = toupper(strToConvert[i]);
30 for(
unsigned int i=0;i<strToConvert.length();i++)
32 strToConvert[i] = tolower(strToConvert[i]);
55 std::string
NumToString(
const float f,
unsigned int width,
unsigned int precise) {
57 ss << std::setw(width) << std::setprecision(precise) << f;
61 std::string
NumToString(
const double d,
unsigned int width,
unsigned int precise) {
63 ss << std::setw(width) << std::setprecision(precise) << d;
70 char*
itoa(
int value,
char* result,
int base )
73 if (base < 2 || base > 16) {
74 *result = 0;
return result;
81 *out =
"0123456789abcdef"[ std::abs( quotient % base ) ];
87 if ( value < 0 && base == 10) *out++ =
'-';
89 std::reverse( result, out );
97 std::string
itoa(
int value,
int base)
99 enum { kMaxDigits = 35 };
102 buf.reserve( kMaxDigits );
105 if (base < 2 || base > 16)
return buf;
107 int quotient = value;
111 buf +=
"0123456789abcdef"[ std::abs( quotient % base ) ];
113 }
while ( quotient );
116 if ( value < 0 && base == 10) buf +=
'-';
117 std::reverse( buf.begin(), buf.end() );
char * itoa(int value, char *result, int base)
std::string NumToString(const int n)
std::string StringToUpper(std::string strToConvert)
std::string StringToLower(std::string strToConvert)