title: std::stoi() takes first number in string?
body: <p>I was converting string values into integer values with std::stoi() in my program when I noticed that it returned integer value of 25 from a string value of "25,". </p>
  
  <p>This confused me because there is an exception thrown for invalid_argument when the string starts with anything but a number. For an example ",25" would throw an invalid_exception. Based on this I made the assumption that if the entire string value wasn't a number then an exception was thrown. This is not the case I come to realize. For an example "25,543" will return 25.</p>
  
  <p>I ended up making my own function to call std::stoi() only if the entire string value is a number, otherwise, throw an invalid_argument exception.</p>
  
  <p>With that said, I was wondering why it was designed this way or perhaps I don't understand how it works fully. I rather not keep using it if I am going to keep getting surprises like this realization.</p>
  
  <p>Update: I checked the documentation from cppreference.com, I am just not experienced enough in to get it fully. I tried to reverse engineer the std::stoi definition but got the point where its was way above my level of experience. I posted this question with intent to both inform others of its functionality and the desire to know the nitty gritty.</p>