padder

package
v1.6.29 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: BSD-2-Clause-Patent Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ALTERNATE_PADDING_CHARACTER_1 ...
	ALTERNATE_PADDING_CHARACTER_1 rune = 4 // Unicode U+0004: end-of-transmission

	// ALTERNATE_PADDING_CHARACTER_2 ...
	ALTERNATE_PADDING_CHARACTER_2 rune = 5 // Unicode U+0005: enquiry

	// NO_PADDING_CHARACTER ...
	NO_PADDING_CHARACTER rune = 0 // rune zero value is int32(0)

	// PREPEND_SIZE is the minimum number of prepended padding character in the padded result
	PREPEND_SIZE = 2
)

Variables

This section is empty.

Functions

func Apply

func Apply(slice []byte, length int, buildEven bool) (padded []byte, padChar rune, err error)

Apply left pads the passed data (generally a slice) making it at least (PREPEND_SIZE + length) bytes long; if the 'buildEven' parameter is set to `true`, it doesn't take PREPEND_SIZE into account and only adds padding bytes to the left up to the passed length.

func Unapply

func Unapply(padded []byte) (slice []byte, padChar rune, err error)

Unapply removes the left padding from the passed padded data.

Types

This section is empty.

Jump to

Keyboard shortcuts

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