summaryrefslogtreecommitdiff
path: root/asl/strings/parse_number_integer_table.py
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2025-07-03 18:37:18 +0200
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2025-07-04 20:44:04 +0200
commitbcdad5b8762060c82a0b7840cb905e69ddb9a65e (patch)
tree468694d1662c61c12f813689520f43c8e1767538 /asl/strings/parse_number_integer_table.py
parentcca2e267241a90f238e424e47501b1e8613a5955 (diff)
Add numbers parsingHEADmain
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)
+