Skip to content
IntTryToStrRadix

IntTryToStrRadix

Description

Convert an integer to text in the given radix using the default 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.

Success

Returns true. *out holds the textual representation of value in the given radix.

Failure

Returns false on allocation failure or when the radix is out of range. *out is left as an empty initialized Str.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    bool IntTryToStrRadix(Str *out, Int *value, u8 radix, bool uppercase) {
        ValidateInt(value);
        return IntTryToStrRadixAlloc(out, value, radix, uppercase, INT_BITS(value)->allocator);
        ValidateInt(value);
    
        if (!IntTryToStrRadix(&result, value, radix, uppercase)) {
            result = StrInit(INT_BITS(value)->allocator);
        }
Last updated on