/go-indent

Primary LanguageGoMIT LicenseMIT

Go Reference Tests Codecov Go Report

Indent

Indent implements function that allows to indent multiline strings

Installation

go get github.com/backdround/go-indent

Example

package main

import (
	"fmt"
	"github.com/backdround/go-indent"
)

func main() {
	message := fmt.Sprint("some\nmultiline\nmessage")
	indentedMessage := indent.Indent(message, "  ", 1)
	fmt.Println(indentedMessage)
}

output:

  some
  multiline
  message