F

package
v1.4819.1447 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 2 Imported by: 0

README

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`

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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`

Types

This section is empty.

Jump to

Keyboard shortcuts

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