pinyin

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 3 Imported by: 0

README

pinyin - 汉字转拼音

PkgGoDev Build Status Go Report Card Coverage Status GitHub issues Release

Installation

To install the package, run:

go get github.com/go-zoox/pinyin

Getting Started

package main

import (
	"context"

	"github.com/go-zoox/pinyin"
)

func main() {
	fmt.Println(pinyin.String("你好世界"))
	// Output: nihaoshijie

	fmt.Println(pinyin.Slice("你好世界"))
	// Output: [ni hao shi jie]

	fmt.Println(pinyin.Abbr("你好世界"))
	// Output: nhsj
}

License

GoZoox is released under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "1.0.2"

Version is the current version of the i18n package.

Functions

func Abbr

func Abbr(hans string) string

Abbr returns the abbreviation of the hans.

func FirstChars

func FirstChars(hans string) string

FirstChars returns the first char of every pinyin of the given string.

func Slice

func Slice(hans string) []string

Slice returns the pinyin slice of the given string.

func String

func String(hans string) string

String returns the pinyin string of the given string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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