-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutilities.cppm
More file actions
31 lines (23 loc) · 803 Bytes
/
utilities.cppm
File metadata and controls
31 lines (23 loc) · 803 Bytes
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
export module utilities;
import <string>;
import <algorithm>;
using namespace std;
const char digits[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
export namespace utilities {
bool isPrimitiveType(const string& word) {
return (word == "int" || word == "str" || word == "bool" || word == "float");
}
bool isNumber(char c) {
for (int i = 0; i < sizeof(digits) / sizeof(digits[0]); i++) {
if (c == digits[i]) {
return true;
}
}
return false;
}
};
//// bytes in digits / bytes in one element of the array = total num of elements in array (idk why don't ask me)
//// sizeof(digits) / sizeof(digits[0])
//bool isNumber(const string& str) {
// return all_of(str.begin(), str.end(), ::isdigit);
//}