https://github.com/soffes/base62
Swift base62 library
https://github.com/soffes/base62
ios macos swift tvos watchos
Last synced: about 1 year ago
JSON representation
Swift base62 library
- Host: GitHub
- URL: https://github.com/soffes/base62
- Owner: soffes
- License: mit
- Created: 2016-05-20T19:47:38.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2021-12-16T18:10:02.000Z (over 4 years ago)
- Last Synced: 2025-03-28T08:11:17.114Z (about 1 year ago)
- Topics: ios, macos, swift, tvos, watchos
- Language: Swift
- Homepage:
- Size: 11.7 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Base62
Swift [Base62](https://en.wikipedia.org/wiki/Base62) library.
## Usage
Simply import the library and you're good to go.
```swift
import Base62
encode(integer: 123) // "1z"
decode(string: "funky") // 619367412
```
If you prefer, you can use `Base62.encode` instead of just `encode`.
It’s worth noting that you can’t decode an string with a value greater than `Int.max`.
## Thanks
Thanks to the [base62 gem](https://github.com/jtzemp/base62) for a reference implementation.