Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 3 months ago
JSON representation
Encodes base 10 to base 36 and decodes base 36 to base 10.
- Host: GitHub
- URL: https://github.com/tallesl/net-36
- Owner: tallesl
- Created: 2013-12-09T15:16:42.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2024-05-23T01:55:54.000Z (8 months ago)
- Last Synced: 2024-10-03T08:47:55.801Z (3 months ago)
- Topics: base-10, base-36, converter, csharp, decode, dot-net, encode, math, nuget
- Language: C#
- Homepage:
- Size: 938 KB
- Stars: 21
- Watchers: 3
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```