Strings

package
v0.2.43 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AndString

func AndString(vals ...string) string

AndString concatenates a list of strings using commas and the word "and" before the last string.

Parameters:

  • vals: The list of strings to concatenate.

Returns:

  • string: The concatenated string.

func DateStringer

func DateStringer(date time.Time) string

DateStringer prints the date in the format "1st January, 2006".

Parameters:

  • date: The date to print.

Returns:

  • string: The date in the format "1st January, 2006".

func GetOrdinalSuffix

func GetOrdinalSuffix(number int) string

GetOrdinalSuffix returns the ordinal suffix for a given integer.

Parameters:

  • number: The integer for which to get the ordinal suffix.

Returns:

  • string: The ordinal suffix for the number.

For example, for the number 1, the function returns "1st"; for the number 2, it returns "2nd"; and so on.

func OrString

func OrString(vals ...string) string

OrString concatenates a list of strings using commas and the word "or" before the last string.

Parameters:

  • vals: The list of strings to concatenate.

Returns:

  • string: The concatenated string.

func StringsJoiner added in v0.2.36

func StringsJoiner[T fmt.Stringer](values []T, sep string) string

StringsJoiner joins a list of fmt.Stringer values using a separator.

Parameters:

  • values: The list of fmt.Stringer values to join.
  • sep: The separator to use when joining the strings.

Returns:

  • string: The string representation of the values.

func TimeStringer

func TimeStringer(time time.Time) string

TimeStringer prints the time in the format "3:04 PM".

Parameters:

  • time: The time to print.

Returns:

  • string: The time in the format "3:04 PM".

Types

This section is empty.

Jump to

Keyboard shortcuts

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