summaryrefslogtreecommitdiff
path: root/asl/strings/parse_number_integer_table.py
diff options
context:
space:
mode:
Diffstat (limited to 'asl/strings/parse_number_integer_table.py')
-rw-r--r--asl/strings/parse_number_integer_table.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/asl/strings/parse_number_integer_table.py b/asl/strings/parse_number_integer_table.py
new file mode 100644
index 0000000..7db41fb
--- /dev/null
+++ b/asl/strings/parse_number_integer_table.py
@@ -0,0 +1,24 @@
+a = ord('a')
+f = ord('f')
+A = ord('A')
+F = ord('F')
+n0 = ord('0')
+n9 = ord('9')
+
+output = ""
+
+for i in range(0, 16):
+ for j in range(0, 16):
+ v = i * 16 + j
+ n = -1
+ if v >= a and v <= f:
+ n = v - a + 10
+ elif v >= A and v <= F:
+ n = v - A + 10
+ elif v >= n0 and v <= n9:
+ n = v - n0
+ output += f"{n:>2}, "
+ output += "\n"
+
+print(output)
+