¡@

Home 

c++ Programming Glossary: converttoint

How to check std::string if its indeed an integer?

http://stackoverflow.com/questions/16181630/how-to-check-stdstring-if-its-indeed-an-integer

std string const s std runtime_error s inline int convertToInt std string const s bool failIfLeftoverChars true std istringstream.. c if i x failIfLeftoverChars i.get c throw BadConversion convertToInt s return x int main std cout convertToInt 100 std endl std cout.. BadConversion convertToInt s return x int main std cout convertToInt 100 std endl std cout convertToInt 100 std endl std cout convertToInt..