Standard library / net/textproto
textproto.Reader.ReadContinuedLine()
Combine continuation lines beginning with space or tab, separating them with a single space and trimming outer ASCII whitespace. Expected stdout: 'hello world\nnext\n'.
Formal Syntax & Structure
go syntaxgo
func (r *Reader) ReadContinuedLine() (string, error)Return Value
(string, error)
Unfolded line and error.
Working Example
Example Snippetgo
package main
import ( "bufio" "fmt" "net/textproto" "strings")
func main() { r := textproto.NewReader(bufio.NewReader(strings.NewReader("hello\r\n world\r\nnext\r\n"))) fmt.Println(must(r.ReadContinuedLine())) fmt.Println(must(r.ReadContinuedLine()))}
func must[T any](v T, e error) T { if e != nil { panic(e) } return v}func check(e error) { if e != nil { panic(e) }}