stringfunction

package
v0.0.0-...-88b8dca Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

=============================================================================

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatFileSize

func FormatFileSize(size int64) string

FormatFileSize converts a file size in bytes (like 5242880) into a nice human-readable string like "5.00 MB" or "1.37 GB".

It uses decimal/SI units (1000-based) rather than binary units (1024-based).

Example outputs:

0               → "0B"
512             → "512.00 B"
1536            → "1.54 kB"
2_500_000       → "2.50 MB"
7_429_000_000   → "7.43 GB"

func PlaceOverlay

func PlaceOverlay(x, y int, fg, bg string, opts ...WhitespaceOption) string

PlaceOverlay places fg on top of bg.

Types

type WhitespaceOption

type WhitespaceOption func(*whitespace)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL