Pinyin

package module
v0.0.0-...-fcd7df4 Latest Latest
Warning

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

Go to latest
Published: May 28, 2014 License: MIT Imports: 2 Imported by: 2

README

golang-chinese-to-pinyin

中文转拼音golang实现

install

go get github.com/l2x/golang-chinese-to-pinyin

example

package main

import (
    "fmt"
    "github.com/l2x/golang-chinese-to-pinyin"
)

func main() {
    s := "天气不错"

    py := Pinyin.New()
    p, _ := py.Convert(s)

    fmt.Println(p)
    //Tian Qi Bu Cuo


    //设置分隔符
    //首字母是否大写
    py.Split = "-"
    py.Upper = false
    p, _ = py.Convert(s)
    fmt.Println(p)
    //tian-qi-bu-cuo
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pinyin

type Pinyin struct {
	//分隔符
	Split string
	//是否首字母大写
	Upper bool
}

func New

func New() Pinyin

func (*Pinyin) Convert

func (c *Pinyin) Convert(s string) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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