formats

package module
v0.0.0-...-984e61c Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2019 License: GPL-3.0 Imports: 15 Imported by: 2

README

formats

format functions for some normal type

Introduction

Go inner types
Time formats
Reg formats

Documentation

Index

Constants

View Source
const (
	Date  = "2006-01-02"
	ZDate = "2006-1-2"

	DashTime = Date + "-15-04-05"
	DateTime = Date + " 15:04:05"
	Time     = "15:04:05"

	ChineseDate  = "2006年01月02日"
	ChineseZDate = "2006年1月2日"

	DefalutDateTime = "0001-01-01 00:00:00"
)

Datas

View Source
const (
	MonthLunarDays   int = 30
	MonthSolarDays   int = 31
	MonthFebLeapDays int = 29
	MonthFebDays     int = 28
)

MonthDays

Variables

This section is empty.

Functions

func FindStringSubmatchMap

func FindStringSubmatchMap(s, exp string) (map[string]string, bool)

FindStringSubmatchMap infomation: returns a map of strings holding the text of the leftmost match of the regular expression in s and the matches, if any, of its subexpressions, as defined by the 'Submatch' description in the package comment. A return value of nil indicates no match.

func FormatChineseDate

func FormatChineseDate(t time.Time) string

FormatChineseDate format chinese date string

func FormatChineseZDate

func FormatChineseZDate(t time.Time) string

FormatChineseZDate format chinese no 0 date string

func FormatDashTime

func FormatDashTime(t time.Time) string

FormatDashTime format datetime string with dash

func FormatDate

func FormatDate(t time.Time) string

FormatDate format date string

func FormatDateTime

func FormatDateTime(t time.Time) string

FormatDateTime format datetime string

func FormatGMT

func FormatGMT(t time.Time) string

FormatGMT format GMT string

func FormatRFC3339

func FormatRFC3339(t time.Time) string

FormatRFC3339 format RFC3339 string

func FormatRFC3339Nano

func FormatRFC3339Nano(t time.Time) string

FormatRFC3339Nano format RFC3339Nano string

func FormatTime

func FormatTime(t time.Time) string

FormatTime format time string

func FormatZDate

func FormatZDate(t time.Time) string

FormatZDate format no 0 date string

func GbkToUtf8

func GbkToUtf8(s []byte) ([]byte, error)

GbkToUtf8 gbk to utf8

func GetMonthDays

func GetMonthDays(year, month int) int

GetMonthDays get year's month days

func GetTimeMonthDays

func GetTimeMonthDays(t time.Time) int

GetTimeMonthDays get time's month days

func HideString

func HideString(origin string, start, length int) string

HideString hide some words origin: the string to be hidden start: from 1 to len(origin), replace * from beginning length: replace origin length from the beginning

func IntToString

func IntToString(value interface{}) (string, error)

IntToString parse int to string

func IsZero

func IsZero(t time.Time) bool

IsZero judge time is zero

func ParseStringByteSize

func ParseStringByteSize(key string) *big.Int

ParseStringByteSize return big size

func ParseStringTime

func ParseStringTime(s string, defValue ...time.Duration) time.Duration

ParseStringTime return time.Duration

func QuoteBytesToASCIIWithoutBackslashed

func QuoteBytesToASCIIWithoutBackslashed(bs []byte) string

QuoteBytesToASCIIWithoutBackslashed strconv.QuoteToASCII by bytes

func QuoteToASCIIWithoutBackslashed

func QuoteToASCIIWithoutBackslashed(s string) string

QuoteToASCIIWithoutBackslashed strconv.QuoteToASCII without Backslashed \\ import strconv

func RoundFund

func RoundFund(fund float64) int64

RoundFund round fund to int64

func StringToDate

func StringToDate(t string) (time.Time, error)

StringToDate paser string to date

func StringToDateTime

func StringToDateTime(t string) (time.Time, error)

StringToDateTime paser string to datetime

func ToFloat64

func ToFloat64(value interface{}) (float64, error)

ToFloat64 covert any type to float64

func ToInt

func ToInt(value interface{}) (int, error)

ToInt parse value to int

func ToInt64

func ToInt64(value interface{}) (int64, error)

ToInt64 parse value to int64

func UnixToTime

func UnixToTime(unix int64) time.Time

UnixToTime Parse unix to time

func Utf8ToGbk

func Utf8ToGbk(s []byte) ([]byte, error)

Utf8ToGbk utf8 to gbk

Types

type Int64s

type Int64s []int64

Int64s array int64

func (Int64s) Len

func (x Int64s) Len() int

func (Int64s) Less

func (x Int64s) Less(i, j int) bool

func (Int64s) Swap

func (x Int64s) Swap(i, j int)

type Ints

type Ints []int

Ints array int

func (Ints) Len

func (x Ints) Len() int

func (Ints) Less

func (x Ints) Less(i, j int) bool

func (Ints) Swap

func (x Ints) Swap(i, j int)

type Strings

type Strings []string

Strings array string

func (Strings) Len

func (x Strings) Len() int

func (Strings) Less

func (x Strings) Less(i, j int) bool

func (Strings) Swap

func (x Strings) Swap(i, j int)

type Uint32s

type Uint32s []uint32

Uint32s array uint32

func (Uint32s) Len

func (x Uint32s) Len() int

func (Uint32s) Less

func (x Uint32s) Less(i, j int) bool

func (Uint32s) Swap

func (x Uint32s) Swap(i, j int)

type Uints

type Uints []uint

Uints array uint

func (Uints) Len

func (x Uints) Len() int

func (Uints) Less

func (x Uints) Less(i, j int) bool

func (Uints) Swap

func (x Uints) Swap(i, j int)

Jump to

Keyboard shortcuts

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