uce/site/doc/pages/to_u64.txt
2026-06-15 21:42:50 +00:00

24 lines
541 B
Plaintext

:sig
u64 to_u64(String s, u64 fallback = 0)
:params
s : string to parse
fallback : value returned when `s` is empty or not a complete unsigned integer
return value : parsed u64, or `fallback`.
:see
>types
to_s64
to_f64
to_bool
int_val
:content
Parses a trimmed string as a base-10 unsigned integer.
Unlike `int_val()`, the whole trimmed string must be consumed by the parser. Empty strings and partially parsed values such as `"42px"` return the fallback.
```uce
u64 limit = to_u64(context.server->config["UPLOAD_LIMIT"], 1048576);
```