This client library allows to convert numbers into base62 strings (see Encode(999) > g7) and back (see Decode(g7) > 999). Base conversion is an approach commonly used for URL shorteners. Base conversion helps to convert the same number between its different numbe representation systems.
$ dotnet add package Base62.ConversionBase conversion is an approach commonly used for URL shorteners. Base conversion helps to convert the same number between its different numbe representation systems.
The conversion table is [0-9a-zA-Z]:
private const string BASE62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
The value 999 is converted into g7 as:
999 = 16 * 62^1 + 7 * 62^0 = "g7"
where g and 7 are the 16th and 7th elements of the BASE62.
var encoded = Base62Converter.Encode(2009215674938); // zn9edcu
var decoded = Base62Converter.Decode("zn9edcu"); // 2009215674938
References: