polonius/shared/is_number.cpp

14 lines
281 B
C++

/***
* Copyright (C) 2024 rail5
*/
#ifndef ALGORITHM
#define ALGORITHM
#include <algorithm>
#endif
inline bool is_number(const std::string &s) {
return !s.empty() && std::find_if(s.begin(),
s.end(), [](unsigned char c) { return !std::isdigit(c); }) == s.end();
}