Standard library / strings
strings.Builder.WriteString()
Appends string bytes and returns byte count and nil error. Expected stdout: '8 <nil> 8\n'.
Formal Syntax & Structure
go syntaxgo
func (b *Builder) WriteString(s string) (int, error)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Data to append or write. |
Return Value
(int, error)
Appends string bytes and returns byte count and nil error.
Working Example
Example Snippetgo
package main
import ( "fmt" "strings")
func main() { var b strings.Builder n, e := b.WriteString("سلام") fmt.Println(n, e, b.Len())}