! \brief Does the string represent the numerical value of 0? * In case leading or trailing white space is provided, the function * returns false. * Requirement for this function: * - This code is allowed to be slow because of simplicity of the code. * * \param[in] str The string to check. In case the string is empty, the function returns false. * \return Return true in case the string repre
| 1297 | * \return Return true in case the string represents a numerical null value. |
| 1298 | **/ |
| 1299 | bool MathLib::isNullValue(const std::string &str) |
| 1300 | { |
| 1301 | if (str.empty() || (!std::isdigit(static_cast<unsigned char>(str[0])) && (str[0] != '.' && str[0] != '-' && str[0] != '+'))) |
| 1302 | return false; // Has to be a number |
| 1303 | |
| 1304 | if (!isInt(str) && !isFloat(str)) |
| 1305 | return false; |
| 1306 | const bool isHex = isIntHex(str) || isFloatHex(str); |
| 1307 | for (const char i : str) { |
| 1308 | if (std::isdigit(static_cast<unsigned char>(i)) && i != '0') // May not contain digits other than 0 |
| 1309 | return false; |
| 1310 | if (i == 'p' || i == 'P' || (!isHex && (i == 'E' || i == 'e'))) |
| 1311 | return true; |
| 1312 | if (isHex && isxdigit(i) && i != '0') |
| 1313 | return false; |
| 1314 | } |
| 1315 | return true; |
| 1316 | } |
| 1317 | |
| 1318 | bool MathLib::isOctalDigit(char c) |
| 1319 | { |