Standard library / strings
strings.Clone()
Returns a copy of a nonempty string with independent backing storage; empty string requires no allocation. Expected stdout: 'hello\n'.
Formal Syntax & Structure
go syntaxgo
func Clone(s string) stringParameters & Attributes
| Name | Type | Description |
|---|---|---|
| s | string | Input text or sequence. |
Return Value
string
Returns a copy of a nonempty string with independent backing storage; empty string requires no allocation.
Working Example
Example Snippetgo
package main
import ( "fmt" "strings")
func main() { fmt.Println(string(strings.Clone("hello")))}