Documentation ¶
Overview ¶
Package format helps formatting various data types
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AutoPluralizer ¶
AutoPluralizer implements fmt.Stringer interface and pluralizes words automatically
Example ¶
fmt.Printf("Jack has %s and Tom has %s.", AutoPluralizer{1, "candy"}, AutoPluralizer{2, "candy"})
Output: Jack has 1 candy and Tom has 2 candies.
func (AutoPluralizer) String ¶
func (c AutoPluralizer) String() string
type RelTime ¶
RelTime implements fmt.Stringer interface and formats a time.Time into a relative value
Example ¶
t := RelTime{time.Now().Add(-5 * time.Minute)} fmt.Println(t)
Output: 5 minutes ago
Example (Future) ¶
t := RelTime{time.Now().Add(5 * time.Minute)} fmt.Println(t)
Output: 5 minutes from now
Click to show internal directories.
Click to hide internal directories.