baseconv

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2019 License: MIT Imports: 3 Imported by: 1

README

baseconv

Base convert in Golang

It is a Go version of php base_convert

Convert a number between arbitrary bases 在任意进制之间转换数字

Usage


baseconv.Convert("297eb4fe7f4993", 16, 36) // result: "37051e7sxw3"

Documentation

Overview

Package baseconv Convert a number string between arbitrary bases

Index

Constants

View Source
const (
	BASE62Text = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
)

consts

Variables

View Source
var (
	ErrInvalidBase  = errors.New("the base value must be between 2 and 62")
	ErrInvalidNumer = errors.New("the number string is invalid")
)

vars

Functions

func Convert

func Convert(num string, frombase int, tobase int) (string, error)

Convert Convert a number between arbitrary bases

func ConvertBytes

func ConvertBytes(num []byte, frombase int, tobase int) ([]byte, error)

ConvertBytes ...

Types

This section is empty.

Jump to

Keyboard shortcuts

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