Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Go library for Zenkaku/Hankaku conversion

License

NotificationsYou must be signed in to change notification settings

ktnyt/go-moji

Repository files navigation

Build StatusGo Report CardGoDoc

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.

Installation

Usego get:

$ go get github.com/ktnyt/go-moji

Requirements

This package has only been tested on Go >= 1.8. Beware when using lower versions.

Example

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

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

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

Languages


[8]ページ先頭

©2009-2025 Movatter.jp