File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ #include " Converts.h"
2+
3+ int stringToInt (std::string value, std::string_view message) {
4+ try {
5+ int v = std::stoi (value);
6+ return v;
7+ }
8+ catch (std::invalid_argument const & ex) {
9+ std::cout << message << " Erreur final : " << ex.what () << std::endl;
10+ }
11+ return 0 ;
12+ }
13+
14+ double stringToDouble (std::string value, std::string_view message) {
15+ try {
16+ double v = std::stod (value);
17+ return v;
18+ }
19+ catch (std::invalid_argument const & ex) {
20+ std::cout << message << " Erreur final : " << ex.what () << std::endl;
21+ }
22+ return 0 ;
23+ }
Original file line number Diff line number Diff line change 1+ #include < iostream>
2+ #include < vector>
3+ #include < string>
4+ #include < string_view>
5+ #include < sstream>
6+ #include < stdexcept>
7+ #include < algorithm>
8+ #include < optional>
9+ #include < map>
10+ #include < functional>
11+ #include < fstream>
12+
13+ int stringToInt (std::string value, std::string_view message);
14+
15+ double stringToDouble (std::string value, std::string_view message);
You can’t perform that action at this time.
0 commit comments