lang

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package lang contains all language level utilities.

Index

Constants

View Source
const (
	Empty       = ""
	Space       = ' '
	SpaceString = " "
	Slash       = "/"
)

Variables

This section is empty.

Functions

func Assignable

func Assignable[T any](v any) bool

func Bool

func Bool(s *string) (i bool, err error)

func ComputeIf

func ComputeIf[T interface{}](expression bool, tf func() T, ff func() T) T

func Default

func Default[T any](v *T, d T) T

func Dup

func Dup[T any](v T) *T

func FormatL

func FormatL(length int, p string, args ...any) string

func If

func If[T any, V any](expression bool, tf func(T) V, ff func(T) V, arg T) V

func IsBlank

func IsBlank(str string) bool

IsBlank checks if a string is blank or not.

func IsLengthLessThen

func IsLengthLessThen(p *string, l int) bool

func IsLengthLongerThen

func IsLengthLongerThen(p *string, l int) bool

func IsRuneCountLessThen

func IsRuneCountLessThen(p *string, l int) bool

func IsRuneCountLongerThen

func IsRuneCountLongerThen(p *string, l int) bool

func Join

func Join(parts ...*string) string

Join concatenates string pointers with a slash separator.

func JoinWith

func JoinWith(sep string, parts ...*string) string

JoinWith concatenates strings from the parts slice, separated by sep. It skips nil pointers in the parts slice.

func OrDefault

func OrDefault[T any](v *T, d *T) *T

func StringNow

func StringNow() string

func StringTs

func StringTs(t time.Time) string

func StringUUID

func StringUUID() string

func Substring

func Substring(p *string, start int, end int) string

func Ternary

func Ternary[T any](expression bool, t T, f T) T

func ToLong

func ToLong[T any](v interface{}, cvt func(*int64) *T, def *T) *T

ToLong converts any convertable value into int64

func TrimJoin

func TrimJoin(s string, parts ...*string) string

TrimJoin will concatenates strings in rune compitable mode after trimming space and separator, both left and right, from each part.

Types

type Equal

type Equal interface {
	Equal(right any) bool
}

Jump to

Keyboard shortcuts

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