Skip to content

[REQ] Helper function that converts human readable string like 1.5G to bytes (integer form string). #16

@soyfrien

Description

@soyfrien

Is your feature request related to a problem? Please describe.
This is about #15, which I've decided is not a bug.

A helper function that converts swap_size to bytes from a human readable string is required.

Strings can occur with or without decimals, in upper or lower case. Always rounding down, example strings and conversions might be:

swap_size 𝑓(swap_size) multiplier pattern
1234567890 1234567890 10240
1234567890.9 1234567890 10240
1205632.70k 1234567884 10241
1177.375M 1234567168 10242
1.14978G 1234566874 10243

The conversion can be a string in integer form.

Describe the solution you'd like
Perhaps a function that takes a string as an argument and returns a converted string.

Describe alternatives you've considered
I am mostly just curious to see how the help wanted tag works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions