c++ - How to convert an integer to a string -


this question has answer here:

i want convert integer string. tried way didn't work

void foo() {     int y = 1;     string x = static_cast<string>(y);  } 

the std::to_string function should it:

string x = std::to_string(y); 

for opposite, it's std::stoi:

int z = std::stoi(y, nullptr, 10); 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -