stringsupport

package
v0.0.0-...-b1f961f Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2022 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertUTF8ToShiftJIS

func ConvertUTF8ToShiftJIS(text string) ([]byte, error)

ConvertUTF8ToShiftJIS converts a UTF8 string to a Shift-JIS []byte.

Types

type StringConverter

type StringConverter struct {
	Encoding encoding.Encoding
}

StringConverter is a small helper for encoding/decoding strings.

func (*StringConverter) Decode

func (sc *StringConverter) Decode(data []byte) (string, error)

Decode decodes the given bytes as the set encoding.

func (*StringConverter) Encode

func (sc *StringConverter) Encode(data string) ([]byte, error)

Encode encodes the given string as the set encoding.

func (*StringConverter) MustDecode

func (sc *StringConverter) MustDecode(data []byte) string

MustDecode decodes the given bytes as the set encoding. Panics on decode failure.

func (*StringConverter) MustEncode

func (sc *StringConverter) MustEncode(data string) []byte

MustEncode encodes the given string as the set encoding. Panics on encode failure.

Jump to

Keyboard shortcuts

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