Extract a dimension name of a string. Dimension names start with an alpha and continue with numbers or underscores. \param s String from which to extract dimension name. \param p Position at which to start extracting. \return Number of characters in the extracted name.
| 251 | /// \param p Position at which to start extracting. |
| 252 | /// \return Number of characters in the extracted name. |
| 253 | inline std::size_t extractName(const std::string& s, std::string::size_type p) |
| 254 | { |
| 255 | if (!std::isalpha(s[p++])) |
| 256 | return 0; |
| 257 | auto isvalid = [](int c) |
| 258 | { |
| 259 | return std::isalpha(c) || std::isdigit(c) || c == '_' || c == ' '; |
| 260 | }; |
| 261 | return Utils::extract(s, p, isvalid) + 1; |
| 262 | } |
| 263 | |
| 264 | inline std::string fixName(std::string name) |
| 265 | { |
no outgoing calls
no test coverage detected