text

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: MIT Imports: 1 Imported by: 0

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