base62

package module
v0.0.0-...-e793b54 Latest Latest
Warning

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

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

README

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

Documentation

Overview

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

Index

Examples

Constants

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

Variables

This section is empty.

Functions

func Decode

func Decode(s string) (uint32, error)

Decode returns a integer number of a base62 encoded string.

Example
package main

import (
	"codeberg.org/ac/base62"
	"fmt"
)

func main() {
	fmt.Println(base62.Decode("4JmrsS"))
}
Output:

3956928564 <nil>

func Encode

func Encode(num uint32) string

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

Example
package main

import (
	"codeberg.org/ac/base62"
	"fmt"
)

func main() {
	var n uint32 = 3956928564
	fmt.Println(base62.Encode(n))
}
Output:

4JmrsS

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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