Skip to content

Commit

Permalink
Update ex9_51.cpp
Browse files Browse the repository at this point in the history
the second parameter of the function substr( ) shouldn't might less than zero.
  • Loading branch information
CoutingStars authored May 4, 2017
1 parent 4fad72a commit 4fb1069
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ch09/ex9_51.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ wy_Date::wy_Date(const std::string& s)
case 0x10:
day = std::stoi(s.substr(0, s.find_first_of("/")));
month = std::stoi(s.substr(s.find_first_of("/") + 1,
s.find_first_of("/") - s.find_last_of("/")));
s.find_last_of("/") - s.find_first_of("/")-1));
year = std::stoi(s.substr(s.find_last_of("/") + 1, 4));
break;

Expand Down

0 comments on commit 4fb1069

Please sign in to comment.