Changeset 609 for trunk/c++_tools/utility
- Timestamp:
- Aug 30, 2006, 10:49:45 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/c++_tools/utility/utility.cc
r570 r609 38 38 std::stringstream ss(s); 39 39 double a; 40 return (ss>>a); 40 ss>>a; 41 if(ss.fail()) 42 return false; 43 // Check that nothing is left on stream 44 std::string b; 45 ss >> b; 46 return (b.size() ? false : true); 41 47 } 42 48 … … 45 51 std::stringstream ss(s); 46 52 float a; 47 return (ss>>a); 53 ss>>a; 54 if(ss.fail()) 55 return false; 56 // Check that nothing is left on stream 57 std::string b; 58 ss >> b; 59 return (b.size() ? false : true); 48 60 } 49 61 … … 52 64 std::stringstream ss(s); 53 65 int a; 54 return (ss>>a); 66 ss >> a; 67 if(ss.fail()) 68 return false; 69 // Check that nothing is left on stream 70 std::string b; 71 ss >> b; 72 return (b.size() ? false : true); 55 73 } 56 74 … … 61 79 ss >> s2; // to trim surrounding whitespaces 62 80 to_lower(s2); 81 // Check that nothing is left on stream 82 std::string s3; 83 ss >> s3; 84 if(s3.size()) 85 return false; 63 86 std::string nan("nan"); 64 87 return (nan==s2);
Note: See TracChangeset
for help on using the changeset viewer.