【文件属性】:
文件名称:dedent:从多行字符串中删除所有常见的前导空格
文件大小:5KB
文件格式:ZIP
更新时间:2021-03-17 04:28:12
go dedent Go
凹痕
从多行字符串中删除常见的前导空格。 受Python中的启发。
用法/示例
想象以下打印多行字符串的代码段。 您希望缩进在代码和实际输出中都看起来不错。
package main
import (
"fmt"
"github.com/lithammer/dedent"
)
func main () {
s := `
Lorem ipsum dolor sit amet,
consectetur adipiscing elit.
Curabitur justo tellus, facilisis nec efficitur dictum,
fermentum vitae ligula. Sed eu convallis sapien.`
fmt . Println ( dedent . Dedent ( s ))
fmt . Println ( "-----
【文件预览】:
dedent-master
----dedent.go(1KB)
----dedent_test.go(4KB)
----.github()
--------dependabot.yml(210B)
--------FUNDING.yml(18B)
--------workflows()
----LICENSE(1KB)
----README.md(1KB)
----go.mod(35B)