Golang go/doc.ToText() function example
package go/doc
ToText prepares comment text for presentation in textual output. It wraps paragraphs of text to width or fewer Unicode code points and then prefixes each line with the indent. In preformatted sections (such as program text), it prefixes each non-blank line with preIndent.
Golang go/doc.ToText() function usage example
package main
import (
"fmt"
"go/doc"
"bytes"
)
func main() {
var buf bytes.Buffer
comment := "// this line is a comment line"
doc.ToText(&buf, comment, "**", "####", 30)
fmt.Println(buf.String())
}
Output :
**// this line is a comment line
Reference :
Advertisement
Something interesting
Tutorials
+15.8k Golang : Get digits from integer before and after given position example
+6.8k Golang : Get expvar(export variables) to work with multiplexer
+23.5k Golang : Read a file into an array or slice example
+36.7k Golang : Display float in 2 decimal points and rounding up or down
+10.1k Golang : Compare files modify date example
+6.3k Golang : Detect face in uploaded photo like GPlus
+7.5k Golang : Create zip/ePub file without compression(use Store algorithm)
+6.1k Golang : Create new color from command line parameters
+13.8k Generate salted password with OpenSSL example
+39k Golang : How to iterate over a []string(array)
+11.9k Golang : Convert decimal number(integer) to IPv4 address
+10.5k Generate Random number with math/rand in Go