1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 21:02:27 +08:00
Files
lancet/docs/formatter.md
2022-01-30 19:04:07 +08:00

1014 B

Formatter

formatter contains some functions for data formatting.

Source:

https://github.com/duke-git/lancet/blob/main/formatter/formatter.go

Usage:

import (
    "github.com/duke-git/lancet/formatter"
)

Index

Documentation

Comma

Add comma to number by every 3 numbers from right. ahead by symbol char. Param should be number or numberic string.

Signature:

func Comma(v interface{}, symbol string) string

Example:

package main

import (
    "fmt"
    "github.com/duke-git/lancet/formatter"
)

func main() {
    fmt.Println(formatter.Comma("12345", ""))   // "12,345"
    fmt.Println(formatter.Comma(12345.67, "¥")) // "¥12,345.67"
}