helper

package
v1.4.220 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 11 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 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