conv

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package conv

  • Version: 1.0.0
  • Copyright (c) 2021. Pashifika *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

Package conv

  • Version: 1.0.0
  • Copyright (c) 2021. Pashifika *
  • Licensed under the Apache License, Version 2.0 (the "License");
  • you may not use this file except in compliance with the License.
  • You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software
  • distributed under the License is distributed on an "AS IS" BASIS,
  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  • See the License for the specific language governing permissions and
  • limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(b []byte) string

BytesToString convert bytes to string

func CutUnicodeString

func CutUnicodeString(str string, length int) string

CutUnicodeString is like RuneCount but its input is a string.

func FindUnicodeString

func FindUnicodeString(src, find string) bool

FindUnicodeString is use rune to find the string.

func StringToBytes

func StringToBytes(s string) []byte

StringToBytes convert string to bytes

func StringToBytesV2

func StringToBytesV2(s string, buffer int) []byte

StringToBytesV2 convert string to bytes (buffered I/O)

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder(charSet string) (*Decoder, error)

NewDecoder new encoder will use HTML escape sequences for runes that are not supported by the character set.

func (*Decoder) ByteToByte

func (d *Decoder) ByteToByte(src []byte) ([]byte, error)

ByteToByte returns a new byte slice with the result of converting b[:n] using t, where n <= len(b). If err == nil, n will be len(b). It calls Reset on t.

func (*Decoder) ByteToString

func (d *Decoder) ByteToString(src []byte) (string, error)

ByteToString returns a new string with the result of converting b[:n] using t, where n <= len(b). If err == nil, n will be len(b). It calls Reset on t.

func (*Decoder) GetEncoding

func (d *Decoder) GetEncoding() encoding.Encoding

GetEncoding get HTML character set encoder

func (*Decoder) GetReader

func (d *Decoder) GetReader(r io.Reader) *transform.Reader

GetReader returns a new Reader that wraps r by transforming the bytes read via t. It calls Reset on t.

func (*Decoder) StringToByte

func (d *Decoder) StringToByte(src string) ([]byte, error)

StringToByte returns a byte slice with the result of converting s[:n] using t, where n <= len(s). If err == nil, n will be len(s). It calls Reset on t.

func (*Decoder) StringToString

func (d *Decoder) StringToString(src string) (string, error)

StringToString returns a string with the result of converting s[:n] using t, where n <= len(s). If err == nil, n will be len(s). It calls Reset on t.

Jump to

Keyboard shortcuts

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