/net-36

Encodes base 10 to base 36 and decodes base 36 to base 10.

Primary LanguageC#

logo

36

Base 10 to base 36 and vice versa.

Usage

using Base36Library;

// Encoding
Base36.Encode(10);    // returns "A"
Base36.Encode(10000); // returns "7PS"

// Decoding
Base36.Decode("Z");   // returns 35L
Base36.Decode("10");  // returns 36L
Base36.Decode("7PS"); // returns 10000L

// Comparing
Base36.Compare("A", "A"); // 0
Base36.Compare("A", "Z"); // 1
Base36.Compare("Z", "A"); // -1

// Checking for overflow
Base36.WouldOverflow("BARRELROLL"); // False
Base36.WouldOverflow("DOABARRELROLL"); // True