1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-10 15:52:27 +08:00

docs: add doc for package formatter

This commit is contained in:
dudaodong
2022-01-30 19:04:07 +08:00
parent 1629b861cd
commit 739113ef9e
2 changed files with 105 additions and 0 deletions

53
docs/formatter.md Normal file
View File

@@ -0,0 +1,53 @@
# Formatter
formatter contains some functions for data formatting.
<div STYLE="page-break-after: always;"></div>
## Source:
[https://github.com/duke-git/lancet/blob/main/formatter/formatter.go](https://github.com/duke-git/lancet/blob/main/formatter/formatter.go)
<div STYLE="page-break-after: always;"></div>
## Usage:
```go
import (
"github.com/duke-git/lancet/formatter"
)
```
<div STYLE="page-break-after: always;"></div>
## Index
- [Comma](#Comma)
<div STYLE="page-break-after: always;"></div>
## Documentation
### <span id="Comma">Comma</span>
<p>Add comma to number by every 3 numbers from right. ahead by symbol char.
Param should be number or numberic string.</p>
<b>Signature:</b>
```go
func Comma(v interface{}, symbol string) string
```
<b>Example:</b>
```go
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"
}
```