indent

package
v1.1.17 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: BSD-3-Clause Imports: 2 Imported by: 24

Documentation

Overview

Package indent provides trivial indentation generation methods: Tabs, Spaces, and Indent with a selector. Also bytes versions. Just for clarity, simplicity.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytes

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

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

func Len

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

Len returns the length of the indent string given indent char 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 Char, n, width int) string

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

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 Char

type Char int

Char is the type of indentation character to use

const (
	// Tab uses tab for indentation
	Tab Char = iota

	// Space uses spaces for indentation
	Space
)

Jump to

Keyboard shortcuts

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