How to repeat a substring N times into new string in Go

1 Answer

0 votes
package main
 
import (
    "fmt"
    "strings"
)
 
func main() {
    s := strings.Repeat("go ", 3)
    
    fmt.Println(s)
}
 
 
 
/*
run:
  
go go go 
  
*/

 



answered Aug 20, 2020 by avibootz
...