Skip to content

Latest commit

 

History

History

F

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

F

-- import "github.com/kokizzu/gotro/F"

Usage

func If

func If(b bool, yes float64) float64

If simplified ternary operator (bool ? val : 0), returns second argument, if the condition (first arg) is true, returns 0 if not

F.If(true,3.12) // 3.12
F.If(false,3)   // 0

func IfElse

func IfElse(b bool, yes, no float64) float64

IfElse ternary operator (bool ? val1 : val2), returns second argument if the condition (first arg) is true, third argument if not

F.IfElse(true,3.12,3.45))  // 3.12

func ToDateStr

func ToDateStr(num float64) string

ToDateStr convert float64 unix to YYYY-MM-DD

func ToIsoDateStr

func ToIsoDateStr(num float64) string

ToIsoDateStr convert to ISO-8601 string

F.ToIsoDateStr(0) // `1970-01-01T00:00:00`

func ToS

func ToS(num float64) string

ToS convert float64 to string

F.ToS(3.1284)) // `3.1284`

func ToStr

func ToStr(num float64) string

ToStr convert float64 to string with 2 digits behind the decimal point

F.ToStr(3.1284)) // `3.13`