helper

package
v1.4.136 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

helper is helper functions used for commonly used functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AtoB

func AtoB(s string) bool

AtoB converts a string to bool

func AtoF32

func AtoF32(s string) float32

AtoF32 converts a string to float32

func AtoF64

func AtoF64(s string) float64

AtoF64 converts a string to float64

func AtoI16

func AtoI16(s string) int16

func AtoI32

func AtoI32(s string) int32

AtoI32 converts a string to int

func AtoI8

func AtoI8(s string) int8

func AtoU16

func AtoU16(s string) uint16

AtoU16 converts a string to uint16

func AtoU32

func AtoU32(s string) uint32

AtoU32 converts a string to uint32

func AtoU8

func AtoU8(s string) uint8

AtoU8 converts a string to uint8

func BaseName

func BaseName(in string) string

BaseName simplifies a name to a base one

func Clean

func Clean(in string) string

Clean will clean a string of invalid characters

func Deflate

func Deflate(in []byte) ([]byte, error)

Deflate takes a byte slice and compresses it down

func EulerToQuaternion

func EulerToQuaternion(in [3]float32) [4]float32

func FilenameCRC32

func FilenameCRC32(name string) uint32

FilenameCRC32 returns the CRC of a file's name

func GenerateCRC16

func GenerateCRC16(data []byte) (checksum uint16, err error)

GenerateCRC16 places a checksum on the last 2 bytes of writer

func GenerateCRC32

func GenerateCRC32(data []byte) (checksum uint32, err error)

GenerateCRC32 places a checksum on the last 4 bytes of writer

func Inflate

func Inflate(in []byte, size int) ([]byte, error)

func IsFile

func IsFile(path string) bool

IsFile returns true if path is a file

func NumberEnding

func NumberEnding(in string) int

NumberEnding returns a numeric ending to a string with ending pattern _00

func ParseBool

func ParseBool(s string) (bool, error)

ParseBool parses a bool from a string, returning fallback if it fails

func ParseFloat

func ParseFloat(s string) (float64, error)

ParseFloat parses a float from a string, returning fallback if it fails

func ParseFloat32

func ParseFloat32(s string) (float32, error)

ParseFloat32 parses a float32 from a string, returning fallback if it fails

func ParseFloat32Slice2 added in v1.4.129

func ParseFloat32Slice2(s []string) ([2]float32, error)

func ParseFloat32Slice3 added in v1.4.129

func ParseFloat32Slice3(s []string) ([3]float32, error)

func ParseFloat32Slice4 added in v1.4.129

func ParseFloat32Slice4(s []string) ([4]float32, error)

func ParseFloat32Slice6 added in v1.4.129

func ParseFloat32Slice6(s []string) ([6]float32, error)

func ParseFloat64

func ParseFloat64(s string) (float64, error)

ParseFloat64 parses a float64 from a string, returning fallback if it fails

func ParseFloat64Slice2 added in v1.4.129

func ParseFloat64Slice2(s []string) ([2]float64, error)

func ParseFloat64Slice3 added in v1.4.129

func ParseFloat64Slice3(s []string) ([3]float64, error)

func ParseInt

func ParseInt(s string) (int, error)

ParseInt parses an int from a string, returning fallback if it fails

func ParseInt16 added in v1.4.128

func ParseInt16(s string) (int16, error)

ParseInt16 parses a int16 from a string, returning fallback if it fails

func ParseInt32

func ParseInt32(s string) (int32, error)

ParseInt32 parses a int32 from a string, returning fallback if it fails

func ParseInt64

func ParseInt64(s string) (int64, error)

ParseInt64 parses a int64 from a string, returning fallback if it fails

func ParseInt8

func ParseInt8(s string) (int8, error)

ParseInt8 parses a int8 from a string, returning fallback if it fails

func ParseUint

func ParseUint(s string) (uint, error)

ParseUint parses a uint from a string, returning fallback if it fails

func ParseUint16 added in v1.4.128

func ParseUint16(s string) (uint16, error)

ParseUint16 parses a uint16 from a string, returning fallback if it fails

func ParseUint16Slice3 added in v1.4.129

func ParseUint16Slice3(s []string) ([3]uint16, error)

func ParseUint32

func ParseUint32(s string) (uint32, error)

ParseUint32 parses a uint32 from a string, returning fallback if it fails

func ParseUint64

func ParseUint64(s string) (uint64, error)

ParseUint64 parses a uint64 from a string, returning fallback if it fails

func ParseUint8

func ParseUint8(s string) (uint8, error)

ParseUint8 parses a uint8 from a string, returning fallback if it fails

func ParseUint8Slice4 added in v1.4.129

func ParseUint8Slice4(s []string) ([4]uint8, error)

func Pluralize

func Pluralize(in int) string

func ReadFile

func ReadFile(path string) ([]string, error)

ReadFile loads a file and splits it into a string slice

func ReadString

func ReadString(r io.ReadSeeker) (string, error)

ReadString is used to read a CString (zero terminated) from r

func ReadStringHash

func ReadStringHash(hash []byte) string

func SpriteModelEnding

func SpriteModelEnding(in string) (int, int)

func Validate

func Validate(data []byte) error

Validate returns nil if data has a valid CRC checksum

func Write

func Write(data []byte, w io.Writer) error

Write simply writes a CRC to the provided writer

func WriteString

func WriteString(w io.Writer, in string) error

WriteString is used to write a CString (zero terminated) to w

func WriteStringHash

func WriteStringHash(hash string) []byte

Types

This section is empty.

Jump to

Keyboard shortcuts

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