str

package
v3.0.0-alpha-29 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Helpers for formatting strings. We avoid the use of the fmt package for the benefit of environments that care about minimizing executable size.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Itod

func Itod[T Int](n T) string

Itod formats signed integers as decimals.

func PtrToHex

func PtrToHex[T any](p *T) string

func Slice

func Slice[T Stringer](s []T) string

Slice formats a slice of values which themselves implement Stringer.

func UToHex

func UToHex[T Uint](n T) string

UToHex returns n formatted in hexidecimal.

func Utod

func Utod[T Uint](n T) string

Utod formats unsigned integers as decimals.

func ZeroPad

func ZeroPad(count int, value string) string

ZeroPad pads value to the left with zeros, making the resulting string count bytes long.

Types

type Int

type Int interface {
	~int8 | ~int16 | ~int32 | ~int64 | ~int
}

type Stringer

type Stringer interface {
	String() string
}

Stringer is equivalent to fmt.Stringer

type Uint

type Uint interface {
	~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uint | ~uintptr
}

Jump to

Keyboard shortcuts

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