JustEnoughMod
Loading...
Searching...
No Matches
Util.hpp
1#ifndef UTIL_UTIL_HPP
2#define UTIL_UTIL_HPP
3
4namespace JEM {
5 constexpr auto atoi(const char *ch) -> int {
6 int i = 0;
7
8 while (*ch != '\0') {
9 if (*ch < 48 || *ch > 57) {
10 break;
11 }
12
13 i *= 10;
14 i += *ch - 48;
15
16 ++ch;
17 }
18
19 return i;
20 }
21
22 constexpr auto removeAppName(char *path) -> char * {
23 char *orig = path;
24
25 while (*path != '\0') {
26 ++path;
27 }
28 while (*path != '/') {
29 --path;
30 }
31 ++path;
32 *path = '\0';
33
34 return orig;
35 }
36} // namespace JEM
37
38#endif