From the course: Learning the Go Standard Library

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Using Printf and Sprintf

Using Printf and Sprintf - Go Tutorial

From the course: Learning the Go Standard Library

Start my 1-month free trial

Using Printf and Sprintf

- [Instructor] For this example, we're going to look at two more string formatting functions, print F and S print F. And just like print and print line, these functions can be used to prepare strings for output. But they offer some more flexibility and power. So these functions make use of the formatting verbs and if we scroll down here in the docs, you can see that these are some of the formatting verbs here in the documentation. And these are codes that start with a percent character that let us determine how different pieces of data will be represented in the formatted string. Now there's a lot of these codes and you can see that there's some just for general use and pulling and integer values and floating points and strings and so on. So we're not going to go through all of them but we're just going to touch on the most important ones. So let's switch over to our code in the editor. And what I'm going to do is in the…

Contents