Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tallesl/net-36

Encodes base 10 to base 36 and decodes base 36 to base 10.
https://github.com/tallesl/net-36

base-10 base-36 converter csharp decode dot-net encode math nuget

Last synced: 5 days ago
JSON representation

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

Awesome Lists containing this project

README

        



logo

# 36

[![][build-img]][build]
[![][nuget-img]][nuget]

[Base 10] to [base 36] and vice versa.

[build]: https://github.com/tallesl/net-36/actions
[build-img]: https://github.com/tallesl/net-36/actions/workflows/dotnet.yml/badge.svg
[nuget]: https://www.nuget.org/packages/36
[nuget-img]: https://badge.fury.io/nu/36.svg
[Base 10]: https://en.wikipedia.org/wiki/Decimal
[base 36]: https://en.wikipedia.org/wiki/Base36

## Usage

```cs
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
```