Go String(): Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 2: Line 2:
* [[Go_Language#Control_Default_Format_for_Type_Values_with_String()|Go Language]]
* [[Go_Language#Control_Default_Format_for_Type_Values_with_String()|Go Language]]
* [[Go Code Examples#g4LX|Go Code Examples]]
* [[Go Code Examples#g4LX|Go Code Examples]]
* [[Go_Package_fmt#fmt.Stringer|The <tt>fmt</tt> Package]]


=Overview=
=Overview=

Revision as of 23:40, 30 August 2024

Internal

Overview

type Stringer interface {
  String() string
}

Stringer is implemented by any type that has a String() method, which defines the "native" format for that value. The String() method is used to print values passed as an operand to any format that accepts a string or to an unformatted printer such as Print. For a usage example, see:

The Equivalent of Java toString() in Go