Standard library / go/doc/comment

go/doc/comment.Parser.Parse()

Parses doc-comment text after comment markers have been removed. Expected stdout: '2\n'.

Formal Syntax & Structure

go syntaxgo
func (p *Parser) Parse(text string) *Doc

Parameters & Attributes

NameTypeDescription
textstringInput to the operation as described above.

Return Value

*Doc

Parses doc-comment text after comment markers have been removed.

Working Example

Example Snippetgo
package main
import (  "fmt"  "go/doc/comment")
func main() { p := comment.Parser{}; d := p.Parse("Hello\n\nWorld"); fmt.Println(len(d.Content)) }
Go Reference