indent

package
v0.3.1 Latest Latest
Warning

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

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

Documentation

Overview

Package indent provides indentation generation methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

func Bytes(ich Character, n, width int) []byte

Bytes returns []byte of n tabs or n*width spaces depending on the indent character.

func Len

func Len(ich Character, n, width int) int

Len returns the length of the indent string given indent character and indent level.

func SpaceBytes

func SpaceBytes(n, width int) []byte

SpaceBytes returns a []byte of n*width spaces.

func Spaces

func Spaces(n, width int) string

Spaces returns a string of n*width spaces.

func String

func String(ich Character, n, width int) string

String returns a string of n tabs or n*width spaces depending on the indent character.

func TabBytes

func TabBytes(n int) []byte

TabBytes returns []byte of n tabs.

func Tabs

func Tabs(n int) string

Tabs returns a string of n tabs.

Types

type Character added in v0.2.1

type Character int32 //enums:enum

Character is the type of indentation character to use.

const (
	// Tab indicates to use tabs for indentation.
	Tab Character = iota

	// Space indicates to use spaces for indentation.
	Space
)
const CharacterN Character = 2

CharacterN is the highest valid value for type Character, plus one.

func CharacterValues added in v0.2.1

func CharacterValues() []Character

CharacterValues returns all possible values for the type Character.

func (Character) Desc added in v0.2.1

func (i Character) Desc() string

Desc returns the description of the Character value.

func (Character) Int64 added in v0.2.1

func (i Character) Int64() int64

Int64 returns the Character value as an int64.

func (Character) MarshalText added in v0.2.1

func (i Character) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Character) SetInt64 added in v0.2.1

func (i *Character) SetInt64(in int64)

SetInt64 sets the Character value from an int64.

func (*Character) SetString added in v0.2.1

func (i *Character) SetString(s string) error

SetString sets the Character value from its string representation, and returns an error if the string is invalid.

func (Character) String added in v0.2.1

func (i Character) String() string

String returns the string representation of this Character value.

func (*Character) UnmarshalText added in v0.2.1

func (i *Character) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Character) Values added in v0.2.1

func (i Character) Values() []enums.Enum

Values returns all possible values for the type Character.

Jump to

Keyboard shortcuts

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