indent

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: BSD-3-Clause Imports: 3 Imported by: 0

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

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

func CharacterValues() []Character

CharacterValues returns all possible values for the type Character.

func (Character) Desc

func (i Character) Desc() string

Desc returns the description of the Character value.

func (Character) Int64

func (i Character) Int64() int64

Int64 returns the Character value as an int64.

func (Character) MarshalText

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

MarshalText implements the encoding.TextMarshaler interface.

func (*Character) SetInt64

func (i *Character) SetInt64(in int64)

SetInt64 sets the Character value from an int64.

func (*Character) SetString

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

func (i Character) String() string

String returns the string representation of this Character value.

func (*Character) UnmarshalText

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Character) Values

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