Universal base conversion with significant leading zero support
Project description
ubase-core
ubase-core -e 123456789 62 1
Universal base conversion.
Install:
pip install ubase-core
Import:
from ubase import uBase
Function
uBase(n, b, s, m=0, x=None, u=0, safe=1)
| parameter | meaning |
|---|---|
| n | integer to encode or string to decode |
| b | base or selector |
| s | significant leading zeros (1 on, 0 off) |
| m | output mode (0 symbols, 1 hex codepoints) |
| x | exclusions (characters and/or unicode range ids) |
| u | unicode mode (0 curated, 1` full unicode order) |
| safe | filter problematic unicode |
Base selectors
| value | meaning |
|---|---|
b >= 2 |
normal base |
b = 0 |
base62 + emoji |
b = 1 |
emoji alphabet |
Example
from ubase import uBase
x = 1111111110
encoded = uBase(x,10,1)
decoded = uBase(encoded,10,1)
print(encoded)
print(decoded)
CLI
Encode:
ubase-core -e 1111111110 10 1
Decode:
ubase-core -d "000000000" 10 1
Hex output:
ubase-core -e 1111111110 10 1 -m 1
Unicode base:
ubase-core -e 1111111110 128 1 -u 1
Exclude characters:
ubase-core -e 1111111110 128 1 -x 21 0OIl
Module execution
You can also run:
python -m ubase -e 1111111110 10 1
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ubase_core-0.1.0.tar.gz
(5.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ubase_core-0.1.0.tar.gz.
File metadata
- Download URL: ubase_core-0.1.0.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1b4fe719876c9f74534a9964376b4fc823403a9911f82eba020b91b0bee1c0c
|
|
| MD5 |
0e3a66b0105704d20ecd92a8565472a4
|
|
| BLAKE2b-256 |
2f601f3acbadc1c01b8b1999567ec902ab54c5693a308de77b30332fdcc04378
|
File details
Details for the file ubase_core-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ubase_core-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd82c34c9eeff373514c0545062c9dac80bdfc16b7048b4d0a3adcf37820f06d
|
|
| MD5 |
fe81ea4cc67e8b38029865757a667d4b
|
|
| BLAKE2b-256 |
bd42c3c7e26aa2ea15827b8c31617ea6f1ff55903f2d3bc8a6fe44fe622ae072
|