unidecode

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 5 Imported by: 28 modules, 26 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.

README

unidecode

Go Reference Tests

Unicode transliterator in Golang - Replaces non-ASCII characters with their ASCII approximations.

Fork of https://github.com/rainycape/unidecode

Example

package main

import (
	"fmt"

	"github.com/gosimple/unidecode"
)

func main() {
	decoded := unidecode.Unidecode("Łódź")
	fmt.Println(decoded)
	// Output: Lodz
}
Requests or bugs?

https://github.com/gosimple/unidecode/issues

Installation

go get -u github.com/gosimple/unidecode

Benchmark

go test -run=NONE -bench=. -benchmem -count=6 ./... > old.txt
# make changes
go test -run=NONE -bench=. -benchmem -count=6 ./... > new.txt

go install golang.org/x/perf/cmd/benchstat@latest

benchstat old.txt new.txt

Add new characters

  1. Edit table.txt file.

  2. Rebuild table.go file:

    go run ./make_table.go
    

Documentation

Overview

Package unidecode implements a unicode transliterator which replaces non-ASCII characters with their ASCII approximations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Unidecode

func Unidecode(s string) string

Unidecode implements a unicode transliterator, which replaces non-ASCII characters with their ASCII counterparts. Given an unicode encoded string, returns another string with non-ASCII characters replaced with their closest ASCII counterparts. e.g. Unicode("áéíóú") => "aeiou"

Types

This section is empty.

Jump to

Keyboard shortcuts

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