forked from wavefnd/Wave
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathascii.wave
More file actions
83 lines (63 loc) · 1.04 KB
/
ascii.wave
File metadata and controls
83 lines (63 loc) · 1.04 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
fun is_digit(c: u8) -> bool {
if (c >= 48 && c <= 57) {
return true;
}
return false;
}
fun is_lower(c: u8) -> bool {
if (c >= 97 && c <= 122) {
return true;
}
return false;
}
fun is_upper(c: u8) -> bool {
if (c >= 65 && c <= 90) {
return true;
}
return false;
}
fun is_alpha(c: u8) -> bool {
if (is_lower(c)) {
return true;
}
if (is_upper(c)) {
return true;
}
return false;
}
fun is_alnum(c: u8) -> bool {
if (is_alpha(c)) {
return true;
}
if (is_digit(c)) {
return true;
}
return false;
}
fun is_space(c: u8) -> bool {
if (c == 32) {
return true;
}
if (c == 9) {
return true;
}
if (c == 10) {
return true;
}
if (c == 13) {
return true;
}
return false;
}
fun to_lower(c: u8) -> u8 {
if (is_upper(c)) {
return c + 32;
}
return c;
}
fun to_upper(c: u8) -> u8 {
if (is_lower(c)) {
return c - 32;
}
return c;
}