github.com/blend/go-sdk@v1.20220411.3/stringutil/indent.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package stringutil 9 10 import "strings" 11 12 // Indent applies an indent prefix to a given corpus. 13 func Indent(indent string, corpus string) string { 14 return strings.Join(IndentLines(indent, SplitLines(corpus)), "\n") 15 } 16 17 // IndentLines adds a prefix to a given list of strings. 18 func IndentLines(indent string, corpus []string) []string { 19 for index := 0; index < len(corpus); index++ { 20 corpus[index] = indent + corpus[index] 21 } 22 return corpus 23 }