2808 explained code solutions for 75 technologies


golangHow to format string


package main
import "fmt"

func main() {
  res := fmt.Sprintf("%s is %d", "A", 12)
}ctrl + c
package main

default package declaration

import "fmt"

loads fmt package to operate on strings (and print them)

fmt.Sprintf(

formats given string based on a given template and return result

res

variable will contain formatted string