mirror of
https://github.com/cheat/cheat.git
synced 2024-11-16 08:58:28 +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")
|
||
|
}
|