19 lines
255 B
Go
19 lines
255 B
Go
|
package util
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"github.com/spf13/cast"
|
||
|
)
|
||
|
|
||
|
func CutTail(str string, length int) string {
|
||
|
if len(str) <= length {
|
||
|
return str
|
||
|
}
|
||
|
|
||
|
return str[0:length]
|
||
|
}
|
||
|
|
||
|
func FloatCut(f float64) float64 {
|
||
|
return cast.ToFloat64(fmt.Sprintf("%.2f", f))
|
||
|
}
|