feat: add space account page

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
juancwu 2026-04-22 03:44:04 +00:00
commit d747454f4a
8 changed files with 169 additions and 2 deletions

View file

@ -0,0 +1,35 @@
package utils
import "strings"
func FormatDecimalWithThousands(numStr string) (string, error) {
// Split into integer and decimal parts
parts := strings.SplitN(numStr, ".", 2)
intPart := parts[0]
// Handle negative numbers
negative := false
if strings.HasPrefix(intPart, "-") {
negative = true
intPart = intPart[1:]
}
// Insert thousand separators
var result []byte
for i, c := range intPart {
if i > 0 && (len(intPart)-i)%3 == 0 {
result = append(result, ',')
}
result = append(result, byte(c))
}
// Reassemble
formatted := string(result)
if len(parts) == 2 {
formatted += "." + parts[1]
}
if negative {
formatted = "-" + formatted
}
return formatted, nil
}