Go strings Package Repeat()

Introduction

To repeat a string, use the Repeat function:

package main// ww  w. j  av  a  2  s .  com
import ( 
    "fmt" 
    "strings" 
) 

func main() { 
    // func Repeat(s string, count int) string 
    fmt.Println(strings.Repeat("a", 5)) 
    // => "aaaaa" 
} 



PreviousNext

Related