summaryrefslogtreecommitdiffstats
path: root/Src/CharTools.h
diff options
context:
space:
mode:
authorLeonetienne <leonetienne@hotmail.de>2022-02-12 18:19:05 +0100
committerLeonetienne <leonetienne@hotmail.de>2022-02-12 18:19:05 +0100
commit91d7f8da33f62e2886e369f790a2d103d5392156 (patch)
tree59d607913506bf522121c0e566a9a3852fce084a /Src/CharTools.h
parent1148037c82b6ac2db366da19cfab801dfb4e88f8 (diff)
Added CharTools functionality
Diffstat (limited to 'Src/CharTools.h')
-rw-r--r--Src/CharTools.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/Src/CharTools.h b/Src/CharTools.h
new file mode 100644
index 0000000..3d7f255
--- /dev/null
+++ b/Src/CharTools.h
@@ -0,0 +1,41 @@
+#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.
+ 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);
+
+ //! Checks whether or not `c` is an uppercase character.
+ static bool IsUpper(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