fastconv

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: MIT Imports: 3 Imported by: 8 modules, 14 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Fast conversion algorithms

Byte-string-rune conversion

At the moment supports the following conversion:

  • []byte -> string using BytesToString()/B2S()
  • string -> []byte using StringToBytes()/S2B()
  • []byte -> []rune using AppendBytesToRunes()/AppendB2R()
  • []rune -> []byte using AppendRunesToBytes()/AppendR2B()
  • string -> []rune using AppendStringToRunes()/AppendS2R()
  • []rune -> string using AppendRunesToString()/AppendR2S()

All functions perform fast conversions using unsafe cast and/or buffer approach.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendB2R added in v1.0.1

func AppendB2R(dst []rune, b []byte) []rune

AppendB2R is a shorthand alias of AppendBytesToRunes().

func AppendBytesToRunes added in v1.0.1

func AppendBytesToRunes(dst []rune, p []byte) []rune

AppendBytesToRunes converts byte array to runes array.

func AppendR2B added in v1.0.1

func AppendR2B(dst []byte, r []rune) []byte

AppendR2B is a shorthand alias of AppendRunesToBytes().

func AppendR2S added in v1.0.1

func AppendR2S(buf []byte, r []rune) ([]byte, string)

AppendR2S is a shorthand alias of AppendRunesToString().

func AppendRunesToBytes added in v1.0.1

func AppendRunesToBytes(dst []byte, r []rune) []byte

AppendRunesToBytes converts runes array to bytes array.

func AppendRunesToString added in v1.0.1

func AppendRunesToString(buf []byte, r []rune) ([]byte, string)

AppendRunesToString converts runes array to string using byte buffer.

func AppendS2R added in v1.0.1

func AppendS2R(dst []rune, s string) []rune

AppendS2R is a shorthand alias of AppendStringToRunes().

func AppendStringToRunes added in v1.0.1

func AppendStringToRunes(dst []rune, s string) []rune

AppendStringToRunes converts string to runes array.

func B2S

func B2S(b []byte) string

B2S is a shorthand alias of BytesToString().

func BytesToString

func BytesToString(b []byte) string

BytesToString makes fast conversion of bytes array to string.

func S2B

func S2B(s string) []byte

S2B is a shorthand alias of StringToBytes().

func StringToBytes

func StringToBytes(s string) []byte

StringToBytes makes fast conversion of string to bytes sequence.

Types

This section is empty.

Jump to

Keyboard shortcuts

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