Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 411 Bytes

File metadata and controls

25 lines (17 loc) · 411 Bytes

What

This repo holds a variaty of options for converting strings to something else (or the other way around).

Types

Data size

Convert strings of type 5MB to:

  • DataSize(value int64, unit string)
  • To bytes (int64)

Example:

s := "5MB"
d, _ := datasize.FromString(s)
fmt.Println(d.String())

b := d.ToBytes()
fmt.Println(b, "Bytes")

B, _ := datasize.ToBytes(s)
fmt.Println(B, "Bytes")