How to create a string with a repeated character N times in Go

1 Answer

0 votes
package main

import (
    "fmt"
    "strings"
)

func main() {
    repeated := strings.Repeat("*", 10) // Repeats '*' 10 times
    fmt.Println(repeated)
}



/*
run:

**********

*/



 



answered Jul 28, 2025 by avibootz
...