base36

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

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

Go to latest
Published: Oct 2, 2017 License: MIT Imports: 1 Imported by: 2

README

base36

GoDoc Goreportcard

Package base36 implements base36 encoding

Installation

go get github.com/lzjluzijie/base36

Examples

Encode

data := []byte("Hello World!")
encoded := base36.Encode(data)

fmt.Println(string(encoded))

Decode

encoded := "2678lx5gvmsv1dro9b5"
decoded, err := base36.Decode(encoded)

if err != nil{
  fmt.Println(err.Error())
  return
}

fmt.Println(string(decoded))

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(b string) []byte

Decode base36 bytes to source bytes

Example
package main

import (
	"fmt"

	"github.com/lzjluzijie/base36"
)

func main() {
	//Decode example data with base36 encoding.
	encoded := "2678lx5gvmsv1dro9b5"
	decoded := base36.Decode(encoded)

	//Check errors.
	// if decoded == nil {
	// 	fmt.Println("Base36 decode error")
	// 	return
	// }

	//Print decoded data.
	fmt.Println(string(decoded))

}
Output:

Hello World!

func Encode

func Encode(b []byte) string

Encode source bytes to base36 string

Example
package main

import (
	"fmt"

	"github.com/lzjluzijie/base36"
)

func main() {
	//Encode example data with base36 encoding.
	data := []byte("Hello World!")
	encoded := base36.Encode(data)

	//Print encoded data.
	fmt.Println(encoded)

}
Output:

2678lx5gvmsv1dro9b5

Types

This section is empty.

Jump to

Keyboard shortcuts

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