RSS
 

C++: Convert int to string

24 Jul

This is an elegant function to convert int to string to use anywhere:

std::string intToString(int i)
{
    std::stringstream ss;
    std::string s;
    ss < < i;
    s = ss.str();

    return s;
}
 
No Comments

Posted in C++

 

Leave a Reply