/stripmargin

Strips margin space in Go strings similar to Scala's stripMargin method

Primary LanguageGoMIT LicenseMIT

stripmargin

A tiny Go library that allows you to write multiline strings and strip margin, just like you would in Scala.

Usage

import (
  "fmt"
  "github.com/cstanze/stripmargin"
)

// Use '|' to set the left margin,
// then surround in stripmargin.StripMargin
fmt.Println(stripmargin.StripMargin(`
  |Hello,
  |  world!`))

// Prints:
//
// Hello,
//   world!