2022-02-12 18:19:05 +01:00
|
|
|
#ifndef STRINGTOOLS_CHARTOOLS_H
|
|
|
|
#define STRINGTOOLS_CHARTOOLS_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
/* Handy utensils to manipulate characters */
|
|
|
|
|
|
|
|
class CharTools {
|
|
|
|
public:
|
|
|
|
//! Checks whether or not `c` is a vowel. You can define custom vowel characters.
|
2022-02-12 20:07:48 +01:00
|
|
|
static bool IsVowel(const char c, const std::string &vowels = "euioay");
|
2022-02-12 18:19:05 +01:00
|
|
|
|
|
|
|
//! Returns whether or not `c` is a letter.
|
|
|
|
static bool IsLetter(const char c);
|
|
|
|
|
2022-02-12 20:07:48 +01:00
|
|
|
//! Returns whether or not `c` is a digit.
|
|
|
|
static bool IsDigit(const char c);
|
2022-02-12 18:19:05 +01:00
|
|
|
|
|
|
|
//! Checks whether or not `c` is an uppercase character.
|
|
|
|
static bool IsUpper(const char c);
|
|
|
|
|
2022-02-12 20:07:48 +01:00
|
|
|
//! Checks whether or not `c` is a lowercase character.
|
|
|
|
static bool IsLower(const char c);
|
|
|
|
|
2022-02-12 18:19:05 +01:00
|
|
|
//! 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 `c` with the same capitalization as `sign`.
|
|
|
|
static char CopySign(char sign, char c);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //STRINGTOOLS_CHARTOOLS_H
|