Added tests for char tools

This commit is contained in:
Leonetienne
2022-02-12 20:07:48 +01:00
parent cf397f3af8
commit ab1a3672c3
15 changed files with 334 additions and 64 deletions

View File

@@ -8,34 +8,28 @@
class CharTools {
public:
//! Checks whether or not `c` is a vowel. You can define custom vowel characters.
static bool IsVowel(const char c, const std::string& vowels = "euioay");
static bool IsVowel(const char c, const std::string &vowels = "euioay");
//! Returns whether or not `c` is a letter.
static bool IsLetter(const char c);
//! Returns whether or not `c` is a generic character (that contains JUST the sign)
static bool IsGeneric(const char c);
//! Returns whether or not `c` is a digit.
static bool IsDigit(const char c);
//! Checks whether or not `c` is an uppercase character.
static bool IsUpper(const char c);
//! Checks whether or not `c` is a lowercase character.
static bool IsLower(const char c);
//! Will return `c` as an uppercase character.
static char MakeUpper(char c);
//! Will return `c` as a lowercase character.
static char MakeLower(char c);
//! Will return an empty character with the same sign/capitalization as `c`.
static char GetSign(char c);
//! Will return `c` with the same capitalization as `sign`.
static char CopySign(char sign, char c);
//! Generic uppercase character.
static constexpr char UPPERCASE = 0;
//! Generic lowercase character.
static constexpr char LOWERCASE = (1<<5);
};
#endif //STRINGTOOLS_CHARTOOLS_H