Go Package fmt: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 48: Line 48:


* <tt>[https://golang.org/pkg/fmt/#Scanf fmt.Scanf()]</tt>
* <tt>[https://golang.org/pkg/fmt/#Scanf fmt.Scanf()]</tt>
==<tt>fmt.Scanln()</tt>==
* <tt>[https://golang.org/pkg/fmt/#Scanln fmt.Scanln()]</tt>


==<tt>fmt.Errorf()</tt>==
==<tt>fmt.Errorf()</tt>==

Revision as of 18:29, 20 April 2016

External

Internal

Functions

fmt.Printf()

Prints according to a format specifier. Format specifier documentation https://golang.org/pkg/fmt

Pointers

fmt.Printf("%p\n", sPtr)

"%p" prepend the "0x" prefix.

Pointers can be also represented using "%X" (base 16, upper case characters).

Ints

fmt.Printf("%d\n",i)

Characters

fmt.Printf("%c\n",i)

Boolean Values

fmt.Printf("%t\n",b)

fmt.Scanf()

fmt.Scanln()

fmt.Errorf()

Errorf formats according to a format specifier and returns the string as a value that satisfies error. For more on error handling see error handling.