IntTryToStrRadixAlloc
Description
Convert an integer to text in the given radix using an explicit allocator.
Parameters
| Name | Direction | Description |
|---|---|---|
out |
out | Destination string. |
value |
in | Integer to convert. |
radix |
in | Output radix in the range 2..36. |
uppercase |
in | Use uppercase letters for digits above 9. |
alloc |
in | Allocator to bind to the produced string. |
Success
Returns true on success, false on allocation or validation failure.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Io.c:2989:
}
} else {
if (!IntTryToStrRadixAlloc(&temp, value, radix, (fmt_info->flags & FMT_FLAG_CAPS) != 0, o->allocator)) {
return false;
}- In
Int.c:648:
bool IntTryToStrAlloc(Str *out, Int *value, Allocator alloc) {
return IntTryToStrRadixAlloc(out, value, 10, false, alloc);
}- In
Int.c:689:
}
bool IntTryToStrRadixAlloc(Str *out, Int *value, u8 radix, bool uppercase, Allocator alloc) {
Int current;
Str result;- In
Int.c:745:
bool IntTryToStrRadix(Str *out, Int *value, u8 radix, bool uppercase) {
ValidateInt(value);
return IntTryToStrRadixAlloc(out, value, radix, uppercase, INT_BITS(value)->allocator);
} alloc.retry_limit = 4;
ok = IntTryToStrRadixAlloc(&text, &value, 16, true, alloc);
bool result = ok && (ZstrCompare(text.data, "BEEF") == 0) && (text.allocator.effort == alloc.effort) &&
Last updated on