Skip to content
IntTryToStrRadixAlloc

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)
            }
        } else {
            if (!IntTryToStrRadixAlloc(&temp, value, radix, (fmt_info->flags & FMT_FLAG_CAPS) != 0, o->allocator)) {
                return false;
            }
    
    bool IntTryToStrAlloc(Str *out, Int *value, Allocator alloc) {
        return IntTryToStrRadixAlloc(out, value, 10, false, alloc);
    }
    }
    
    bool IntTryToStrRadixAlloc(Str *out, Int *value, u8 radix, bool uppercase, Allocator alloc) {
        Int current;
        Str result;
    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