jlx/libjlx/modules/utils.cppm

25 lines
464 B
C++

module;
#include <cstddef>
#include <array>
#include <string>
#include <initializer_list>
export module utils;
export constexpr bool isletter(char ch) {
return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z');
}
export template<std::size_t N>
constexpr bool is_valid_character_from_set(std::array<std::string, N> haystack, char needle) {
for(auto& a : haystack) {
for(auto& c : a) {
if (c == needle) {
return true;
}
}
}
return false;
}