convert string to number, take care of surrounding parentheses */
| 170 | |
| 171 | /* convert string to number, take care of surrounding parentheses */ |
| 172 | int |
| 173 | StringUtils::str2int(const std::string &s) |
| 174 | { |
| 175 | if (!s.empty() && s[0] == '(') { |
| 176 | assert(s[s.length()-1] == ')'); |
| 177 | return str2int(s.substr(1, s.length()-2)); |
| 178 | } |
| 179 | stringstream ss(s); |
| 180 | int i = -1; |
| 181 | if (s.find("0x")==0) { |
| 182 | ss >> std::hex >> i; |
| 183 | } else { |
| 184 | ss >> i; |
| 185 | } |
| 186 | return i; |
| 187 | } |
| 188 | |
| 189 | std::string |
| 190 | StringUtils::int2str(int i) |
nothing calls this directly
no outgoing calls
no test coverage detected