Reputation: 531
Can any body help me in converting a double value e.g. 0.000015 to string format in Xcode. so that i may use it as a string. In visual C++ we have to_string function but in Xcode it doesnt works. Regards
Upvotes: 0
Views: 2270
Reputation: 1
You can make your 'homebrew' to_string()
function very easy using std::stringstream
:
template<typename T>
std::string to_string(T value)
{
std::ostringstream oss;
oss << value;
return oss.str();
}
Upvotes: 1
Reputation: 2678
If you have a compiler supporting C++11, then std::to_string()
is what you want.
Upvotes: 4