ascii

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 5 Imported by: 2

README

ascii

GoDoc

Converts an unicode string to an ascii string

Install

  go get -u github.com/thanhpk/ascii

Usage

out := ascii.Convert("Trời hôm nay đẹp quá") // Troi hom nay dep qua

Running example

  package main
  import(
    "github.com/thanhpk/ascii"
    "fmt"
  )

  func main() {
    fmt.Println(ascii.Convert("Nam quốc sơn hà mam đế cư"))
    fmt.Println(ascii.Convert("Cuántos años tienes"))
    fmt.Println(ascii.Convert("AppleInc 是苹果公司."))
  }
  // Output:
  // Nam quoc son ha mam de cu
  // Cuantos anos tienes
  // AppleInc .

License

MIT

Documentation

Overview

Package ascii provides a function to convert unicode string to pure ascii

Index

Constants

This section is empty.

Variables

View Source
var VNMAP = map[rune]rune{}/* 134 elements not displayed */

Functions

func Convert

func Convert(text string) string

Convert replaces all non-ascii characters to equivalent ascii characters e.g: â => a, đ => d, ... To ensure the output string is pure ascii, this function remove all characters that does not have equivalent ascii character, for example: 主

Types

This section is empty.

Jump to

Keyboard shortcuts

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