Answers for "print string in go"

Go
5

print in golang

package Main
//you need to import fmt
import ("fmt")

func main(){
	//then you can use:
	fmt.Print("this message will be printed without a linefeed at the end")
	//or
	fmt.Println("this message will be printed with a linefeed a the end")
	//or										   the n is a line feed
 	fmt.Printf("You can also use %s formatings with Printf n (PS : this message won't end with a line feed)","multiples")
  	// will output :
  	/*You can also use multiples formatings with Printf 
      (PS : this message won't end with a line feed)*/
}
// More infos at https://golang.org/pkg/fmt/ or in the source
Posted by: Guest on June-24-2020
4

go format string

s := fmt.Sprintf("string: %s number: %d time: %v", "string", 1, time.Now())
Posted by: Guest on April-10-2020
1

format string go

fmt.Sprintf("foo: %s", bar)
Posted by: Guest on April-07-2020
0

format string go

return fmt.Sprintf("at %v, %s", e.When, e.What)
Posted by: Guest on April-07-2020

Browse Popular Code Answers by Language