Skip to content

jrikhof/any-base-swift

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

AnyBase-Swift

This is a Swift implementation of Kamil Harasimowicz's any-base npm package.

Example

let dec2hex = try! AnyBase(AnyBase.DEC, AnyBase.HEX)
let shortId = try! AnyBase(AnyBase.DEC, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-+!@#$^")
let longId  = try! AnyBase("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-+!@#$^", AnyBase.DEC)

print(try! dec2hex.convert("123456")) // return: '1e240'
print(try! shortId.convert("1234567890")) // return: 'PtmIa'
print(try! longId.convert("PtmIa")) // return: '1234567890'

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages