text

package
v0.12.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package text provides utilities to generate textual output.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasePrinter

type BasePrinter struct{}

BasePrinter is the default printer for common use. It uses fmt.Sprintf underneath.

func (BasePrinter) Sprintf

func (BasePrinter) Sprintf(msg string, val ...interface{}) string

Sprintf formats according to a format specifier and returns the resulting string.

Example
package main

import (
	"fmt"

	"github.com/DoNewsCode/core/text"
)

func main() {
	var printer text.BasePrinter
	fmt.Println(printer.Sprintf("hello %s", "go"))
}
Output:
hello go

type Printer

type Printer interface {
	Sprintf(msg string, val ...interface{}) string
}

Printer is an interface for i18n and l10n manipulations. For example, an Chinese printer can translate the message and arguments to its Chinese counterpart.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL