helper

package
v0.0.0-...-4cbc0eb Latest Latest
Warning

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

Go to latest
Published: Mar 1, 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, fallback bool) bool

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

func ParseFloat

func ParseFloat(s string, fallback float64) float64

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

func ParseFloat32

func ParseFloat32(s string, fallback float32) float32

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

func ParseFloat64

func ParseFloat64(s string, fallback float64) float64

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

func ParseInt

func ParseInt(s string, fallback int) int

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

func ParseInt32

func ParseInt32(s string, fallback int32) int32

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

func ParseInt64

func ParseInt64(s string, fallback int64) int64

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

func ParseInt8

func ParseInt8(s string, fallback int8) int8

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

func ParseUint

func ParseUint(s string, fallback uint) uint

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

func ParseUint32

func ParseUint32(s string, fallback uint32) uint32

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

func ParseUint64

func ParseUint64(s string, fallback uint64) uint64

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

func ParseUint8

func ParseUint8(s string, fallback uint8) uint8

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

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 ReadFixedString

func ReadFixedString(r io.Reader, size uint32) (string, error)

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 WriteFixedString

func WriteFixedString(w io.Writer, in string, size int) error

WriteFixedString will write a string and pad 0x00 until size is satisfied

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