tstrings

package
v0.0.0-...-979f466 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB
	MB
	GB
	TB // Terra 1 << 32
	PB // Peta
	EB // Exa Byte Google has 15 Exabyte of data
	ZB // Zetta Byte  1 << 64
	YB // Yotta Byte
	BB // Bronto byte - https://whatsabyte.com/
	GO // Geop byte
)

Declare KB, Kilobyte, Megabyte, Giga, Tera, Peta, Untyped constants have 256 bit precision

Variables

This section is empty.

Functions

func Basename

func Basename(a string) string

Basename removes directory components and a .suffix

e.g.: a => a, a.go => a, a/b/c.go => c, a/b/c.d.go =? cd.

func Comma

func Comma(s string) string

Comma inserts ',' in a decimal number style fashion

func CommaWithBuf

func CommaWithBuf(s string) string

CommaWithBuf inserts ',' style fashion

func IntsToString

func IntsToString(values []int) string

IntsToString Converts []Int{1, 2, 3, 4} => "[1, 2, 3, 4]"

Note that numbers in golang are all utf-8

Types

type DayOfWeek

type DayOfWeek int8

DayOfWeek Declare days of week

const (
	Sunday    DayOfWeek = iota // Sunday first day of week
	Monday                     // Monday second day of week
	Tuesday                    // Tuesday third day of week
	Wednesday                  // Wednesday forth day of week
	Thursday                   // Thursday fifth day of week
	Friday                     // Friday is day 6
	Saturday                   // Saturday last day
)

func (DayOfWeek) DayName

func (d DayOfWeek) DayName() string

DayName returns name of day to a corresponding day number

func (DayOfWeek) Weekday

func (d DayOfWeek) Weekday() bool

Weekday returns true if a day falls on M-F

func (DayOfWeek) Weekend

func (d DayOfWeek) Weekend() bool

Weekend returns true if a day falls on weekend

type DayOfWeekName

type DayOfWeekName interface {
	DayName() string
	Weekend() bool
	Weekday() bool
}

DayOfWeekName supports these methods

type MonthOfYear

type MonthOfYear int8

MonthOfYear assign a number to a month, Jan = 0

const (
	Jan  MonthOfYear = iota // Jan month 0
	Feb                     // Feb month 1
	Mar                     // Mar month 2
	Apr                     // Apr month 4
	May                     // May month 5
	Jun                     // Jun month 6
	July                    // July month 7
	Aug                     // Aug month 8
	Sep                     // Sep month 9
	Oct                     // Oct month 10
	Nov                     // Nov month 11
	Dec                     // Dec merry Christmas
)

func (MonthOfYear) MonthName

func (m MonthOfYear) MonthName() string

MonthName tells name of the month corresponding to a month number

type MonthOfYearName

type MonthOfYearName interface {
	MonthName() string
}

MonthOfYearName supports name of month

Jump to

Keyboard shortcuts

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