Home

sizeParse25

SizeParse25 is a size parsing utility designed to convert human-readable data size expressions into a fixed internal representation. It is named for its design constraint of limiting the input token to 25 characters and is part of the fictional SizeParse family used in the DataFormatX toolkit. The function is designed to be language-agnostic and suitable for configuration parsing, command-line tools, and data-transfer utilities.

SizeParse25 accepts numeric values with optional decimal fractions and an optional unit suffix. Supported units include

Internally, sizeParse25 converts the input to an unsigned 32-bit byte quantity, rounding the fractional part to

Typical output is a structure containing the computed value in bytes and an indicator of exactness. Examples:

SizeParse25 is used in configuration loaders, data-transfer utilities, and log parsers where predictable, byte-aligned sizes are

B,
KB,
MB,
GB,
TB,
PB,
EB
(decimal
prefixes,
multipliers
of
1,000),
as
well
as
KiB,
MiB,
GiB,
TiB,
PiB
(binary
prefixes,
multipliers
of
1,024).
The
parser
is
case-insensitive
and
tolerates
optional
whitespace
between
the
number
and
the
unit.
A
token
longer
than
25
characters
or
containing
invalid
characters
is
rejected
with
an
error.
the
nearest
byte.
The
parser
first
trims,
then
parses
the
numeric
part,
then
applies
the
unit
multiplier.
If
the
resulting
value
exceeds
the
32-bit
range,
or
if
the
unit
is
ambiguous,
an
error
is
returned.
"1024"
yields
1024
bytes;
"2.5
MB"
yields
2,500,000
bytes;
"1
GiB"
yields
1,073,741,824
bytes.
required.
Limitations
include
the
25-character
input
cap,
potential
ambiguity
between
decimal
and
binary
prefixes,
and
the
32-bit
limit
for
the
returned
value.
It
is
intended
as
a
simple,
fast
parser
for
common
size
expressions
within
its
designed
scope.