base62

package module
v0.0.0-...-29b605f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 3, 2021 License: BSD-2-Clause Imports: 3 Imported by: 14

README

This repository is archived and stays only to not break peoples modules. New home @ https://codeberg.org/ac/base62

base62

base62 (Duosexagesimal) encoding using 62 characters [0-9][A-Z][a-z]

GoDoc License

Examples:

See Encode/Decode examples in example_test.go.

© Antonino Catinello - BSD-License

Documentation

Overview

Package base62 provides encoding using 62 characters. [0-9][A-Z][a-z]

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	// CharacterSet consists of 62 characters [0-9][A-Z][a-z].
	Base         = 62
	CharacterSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
)

Functions

func Decode

func Decode(s string) (int, error)

Decode returns a integer number of a base62 encoded string.

Example
package main

import (
	"fmt"
	"github.com/catinello/base62"
)

func main() {
	fmt.Println(base62.Decode("1ZlfarV"))
}
Output:

89569285645 <nil>

func Encode

func Encode(num int) string

Encode returns a base62 representation as string of the given integer number.

Example
package main

import (
	"fmt"
	"github.com/catinello/base62"
)

func main() {
	n := 89569285645
	fmt.Println(base62.Encode(n))
}
Output:

1ZlfarV

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL