text

package
v0.1.0-beta6 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package text provides text manipulation functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dedent

func Dedent(s string) string

Dedent removes a common indent from all lines in a string. It allows writing multi-line strings in a more readable way. For example:

const s = text.Dedent(`
	foo
	  bar
	baz
`)

The result is:

foo
  bar
baz

The common indent is the number of leading spaces in the first non-empty line. If a line does not have the common prefix, it is reproduced as is, except for the last line, which is ignored if it is blank.

Types

This section is empty.

Jump to

Keyboard shortcuts

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