- Notifications
You must be signed in to change notification settings - Fork2
A Go library for Zenkaku/Hankaku conversion
License
ktnyt/go-moji
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This package provides a Go interface for converting between Zenkaku (全角 i.e. full-width) and Hankaku (半角 i.e. half-width) characters (mostly for Japanese). The library has been largely influenced byniwaringo/moji the JavaScript implementation.
For detailed information of the API, see thedocuments.
Usego get
:
$ go get github.com/ktnyt/go-moji
This package has only been tested on Go >= 1.8. Beware when using lower versions.
package mainimport ("fmt""github.com/ktnyt/go-moji")funcmain() {s:="ABC ABC あがぱ アガパ アガパ"// Convert Zenkaku Eisuu to Hankaku Eisuufmt.Println(moji.Convert(s,moji.ZE,moji.HE))// Convert Hankaku Eisuu to Zenkaku Eisuufmt.Println(moji.Convert(s,moji.HE,moji.ZE))// Convert HiraGana to KataKanafmt.Println(moji.Convert(s,moji.HG,moji.KK))// Convert KataKana to HiraGanafmt.Println(moji.Convert(s,moji.KK,moji.HG))// Convert Zenkaku Katakana to Hankaku Katakanafmt.Println(moji.Convert(s,moji.ZK,moji.HK))// Convert Hankaku Katakana to Zenkaku Katakanafmt.Println(moji.Convert(s,moji.HK,moji.ZK))// Convert Zenkaku Space to Hankaku Spacefmt.Println(moji.Convert(s,moji.ZS,moji.HS))// Convert Hankaku Space to Zenkaku Spacefmt.Println(moji.Convert(s,moji.HS,moji.ZS))}
Copyright (C) 2018 by Kotone Itaya <kotone [at] sfc.keio.ac.jp>
go-moji is released under the terms of the MIT License.SeeLICENSE for details.
About
A Go library for Zenkaku/Hankaku conversion
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.