# Formatter

formatter contains some functions for data formatting.

# Source:

# Usage:

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

# 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 any, symbol string) string

Example:

package main

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

func main() {
    fmt.Println(formatter.Comma("12345", ""))   // "12,345"
    fmt.Println(formatter.Comma(12345.67, "¥")) // "¥12,345.67"
}
Last Updated: 9/29/2022, 1:53:14 PM