summaryrefslogtreecommitdiffstats
path: root/Src/CharTools.h
blob: 66c32c0071a38f9b07567ee151bc5cd6b1717972 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#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 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 `c` with the same capitalization as `sign`.
    static char CopySign(char sign, char c);
};

#endif //STRINGTOOLS_CHARTOOLS_H