unidecode

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: MIT Imports: 3 Imported by: 59

README

go-unidecode

Build Status Coverage Status Go Report Card GoDoc

ASCII transliterations of Unicode text. Inspired by python-unidecode.

Installation

go get -u github.com/mozillazg/go-unidecode

Install CLI tool:

$ go get -u github.com/mozillazg/go-unidecode/unidecode

$ unidecode 北京kožušček
Bei Jing kozuscek

Documentation

API documentation can be found here: https://godoc.org/github.com/mozillazg/go-unidecode

Usage

package main

import (
	"fmt"
	"github.com/mozillazg/go-unidecode"
)

func main() {
	s := "abc"
	fmt.Println(unidecode.Unidecode(s))
	// Output: abc

	s = "北京"
	fmt.Println(unidecode.Unidecode(s))
	// Output: Bei Jing

	s = "kožušček"
	fmt.Println(unidecode.Unidecode(s))
	// Output: kozuscek
}

Documentation

Overview

Package unidecode provide ASCII transliterations of Unicode text

s := "北京kožušček"
fmt.Println(unidecode.Unidecode(s))
// Output: Bei Jing kozuscek

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unidecode

func Unidecode(s string) string

Unidecode implements transliterate Unicode text into plain 7-bit ASCII. e.g. Unidecode("kožušček") => "kozuscek"

Example
s := "北京kožušček"
fmt.Println(unidecode.Unidecode(s))
Output:

Bei Jing kozuscek
Example (ASCII)
s := "abc"
fmt.Println(unidecode.Unidecode(s))
Output:

abc

func Version

func Version() string

Version return version

Types

This section is empty.

Directories

Path Synopsis
cmd
unidecode Module
unidecode module

Jump to

Keyboard shortcuts

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