Skip to content

koron-go/jaconv

Repository files navigation

koron-go/jaconv

PkgGoDev Actions/Go Go Report Card

Package jaconv provides a set of converters related to Japanese.

Sub package Description Example
roma2hira Romaji to hiragana converter konnnichihaこんにちは
hira2kata Hiragana to katakana conveter こんにちはコンニチハ
wide2narrow Full-width (zenkaku) to half-width (hankaku) converter コンニチハコンニチハ
narrow2wide Half-width to (hankaku) to full-width (zenkaku) converter コンニチハコンニチハ

Install and Update

$ go get github.com/koron-go/jaconv@latest

Example codes

Example: roma2hira

import "github.com/koron-go/jaconv/roma2hira"

println(roma2hira.Convert("konnnichiha"))
// Output:
// こんにちは

Example: hira2roma

import "github.com/koron-go/jaconv/hira2roma"

println(hira2roma.Convert("こんにちは"))
// Output:
// コンニチハ

Example: narrow2wide

import "github.com/koron-go/jaconv/narrow2wide"

println(narrow2wide.Convert("コンニチハ"))
// Output:
// コンチニハ

Example: wide2narrow

import "github.com/koron-go/jaconv/wide2narrow"

println(wide2narrow.Convert("コンニチハ"))
// Output:
// コンニチハ