Zen C++ Libraries
Zero-dependency re-usable components for C++
Loading...
Searching...
No Matches
include
zen
char.hpp
1
#ifndef ZEN_CHAR_HPP
2
#define ZEN_CHAR_HPP
3
4
#include "zen/config.hpp"
5
6
ZEN_NAMESPACE_START
7
8
inline
bool
is_digit(
char
ch) {
9
return
ch >= 48 && ch <= 57;
10
}
11
12
inline
bool
is_alpha(
char
ch) {
13
return
(ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122);
14
}
15
16
inline
bool
is_alphanum(
char
ch) {
17
return
is_alpha(ch) || is_digit(ch);
18
}
19
20
inline
bool
is_lalpha(
char
ch) {
21
return
ch >= 97 && ch <= 122;
22
}
23
24
inline
bool
is_ualpha(
char
ch) {
25
return
ch >= 65 && ch <= 90;
26
}
27
28
inline
bool
is_whitespace(
char
ch) {
29
switch
(ch) {
30
case
' '
:
31
case
'\n'
:
32
case
'\r'
:
33
case
'\t'
:
34
return
true
;
35
default
:
36
return
false
;
37
}
38
}
39
40
inline
bool
is_newline(
char
ch) {
41
return
ch ==
'\n'
;
42
}
43
44
inline
int
parse_decimal_digit(
char
ch) {
45
return
ch - 48;
46
}
47
48
ZEN_NAMESPACE_END
49
50
#endif
// of #ifndef ZEN_CHAR_HPP
Generated by
1.15.0