Examples using... fmt.Print()
Recent
Package scanner provides a scanner and tokenizer for UTF-8-encoded text.
It takes an io.Reader providing the source, which then can be tokenized
through repeated calls to the Scan function. For compatibility with
existing tools, the NUL character is not allowed. If the first character
in the source ...
TrimSuffix returns s without the provided trailing suffix string.
If s doesn't end with suffix, s is returned unchanged.
TrimRightFunc returns a slice of the string s with all trailing
Unicode code points c satisfying f(c) removed.
TrimRight returns a slice of the string s, with all trailing
Unicode code points contained in cutset removed.
TrimPrefix returns s without the provided leading prefix string.
If s doesn't start with prefix, s is returned unchanged.
TrimLeftFunc returns a slice of the string s with all leading
Unicode code points c satisfying f(c) removed.
TrimLeft returns a slice of the string s with all leading
Unicode code points contained in cutset removed.
TrimFunc returns a slice of the string s with all leading
and trailing Unicode code points c satisfying f(c) removed.
Trim returns a slice of the string s with all leading and
trailing Unicode code points contained in cutset removed.
RoundingMode determines how a Float value is rounded to the
desired precision. Rounding may change the Float value; the
rounding error is described by the Float's Accuracy.
Output writes the output for a logging event. The string s contains
the text to print after the prefix specified by the flags of the
Logger. A newline is appended if the last character of s is not
already a newline. Calldepth is used to recover the PC and is
provided for generality, although at the ...
A Logger represents an active logging object that generates lines of
output to an io.Writer. Each logging operation makes a single call to
the Writer's Write method. A Logger can be used simultaneously from
multiple goroutines; it guarantees to serialize access to the Writer.
Pipe creates a synchronous in-memory pipe.
It can be used to connect code expecting an io.Reader
with code expecting an io.Writer.
MultiWriter creates a writer that duplicates its writes to all the
provided writers, similar to the Unix tee(1) command.
Decode reads a PNG image from r and returns it as an image.Image.
The type of Image returned depends on the PNG contents.
Drawer contains the Draw method.
Print, Println, and Printf lay out their arguments differently. In this example
we can compare their behaviors. Println always adds blanks between the items it
prints, while Print adds blanks only between non-string arguments and Printf
does exactly what it is told.
Sprint, Sprintln, Sprintf, Fprint...
Print formats using the default formats for its operands and writes to standard output.
Spaces are added between operands when neither is a string.
It returns the number of bytes written and any write error encountered.
Fprint formats using the default formats for its operands and writes to w.
Spaces are added between operands when neither is a string.
It returns the number of bytes written and any write error encountered.
The fmt package's Errorf function lets us use the package's formatting
features to create descriptive error messages.
New returns an error that formats as the given text.
Each call to New returns a distinct error value even if the text is identical.
ReadAll reads all the remaining records from r.
Each record is a slice of fields.
A successful call returns err == nil, not err == io.EOF. Because ReadAll is
defined to read until EOF, it does not treat end of file as an error to be
reported.
This example shows how csv.Reader can be configured to handle other
types of CSV files.
Read reads structured binary data from r into data.
Data must be a pointer to a fixed-size value or a slice
of fixed-size values.
Bytes read from r are decoded using the specified byte order
and written to successive fields of the data.
When decoding boolean values, a zero byte is decoded as false, ...
Multistream controls whether the reader supports multistream files.
TrimRight returns a subslice of s by slicing off all trailing
UTF-8-encoded code points that are contained in cutset.
TrimLeft returns a subslice of s by slicing off all leading
UTF-8-encoded code points contained in cutset.
Go’s math/rand package provides pseudorandom number generation.
We can use channels to synchronize execution across goroutines. Here’s an example of using a blocking receive to wait for a goroutine to finish.