mirror of
https://github.com/cheat/cheat.git
synced 2024-11-25 07:21:36 +01:00
17 lines
273 B
Go
17 lines
273 B
Go
|
package display
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
// Indent prepends each line of a string with a tab
|
||
|
func Indent(str string) string {
|
||
|
out := ""
|
||
|
for _, line := range strings.Split(str, "\n") {
|
||
|
out += fmt.Sprintf("\t%s\n", line)
|
||
|
}
|
||
|
|
||
|
return strings.TrimSuffix(out, "\n")
|
||
|
}
|