mbstring

package module
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: MIT Imports: 3 Imported by: 1

README

mbstring

GitHub

mbstring is a Kana converter written in Go, and influenced by PHP mbstring extension.

Installation

To install mbstring package, you need to install Go and set your Go workspace first.

  1. The first need Go installed (tested by version 1.13+), then you can use the below Go command to install mbstring.
$ go get -u github.com/elfincafe/mbstring
  1. Import it in your code:
import "github.com/elfincafe/mbstring"

Quick start

# assume the following codes in example.go file
$ cat example.go
package main

import (
	"fmt"
	"github.com/elfincafe/mbstring"
)

func main() {
	str := "エムビーストリング"
	fmt.Println(mbstring.ConvKana(str, "KV"))
}
# run example.go
$ go run example.go
エムビーストリング

Author

mbstring is created by Takami (elfincafe.com).

License

mbstring is open source software licensed under the MIT License.

Documentation

Index

Constants

View Source
const (
	VERSION = "0.4.2"
	UNKNOWN = 0
	UTF8    = 1
	SJIS    = 2
	EUCJP   = 3
)

Variables

This section is empty.

Functions

func Capitalize

func Capitalize(s string) string

*

  • Uppercase the first character of each word in a string

func ConvEnc added in v0.4.0

func ConvEnc(s string, to int, from int) (string, error)

*

  • convert encoding

func ConvKana

func ConvKana(s string, opt string) string

*

  • convert kana

func Length

func Length(s string) int

*

  • get character count.

func Lower

func Lower(s string) string

*

  • make a string lowercase.

func TrimWidth

func TrimWidth(s string, start int, width int, marker string) string

*

  • make a string lowercase.

func Upper

func Upper(s string) string

*

  • make a string uppercase.

func Width

func Width(s string) int

*

  • get character width.
  • single byte -> 1
  • multi byte -> 2

Types

This section is empty.

Jump to

Keyboard shortcuts

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