Skip to content

IntToHexStr

IntToHexStr

Description

Convert an integer to a hexadecimal string.

Parameters

Name Direction Description
value in Integer to convert

Usage example (from documentation)

  Str text = IntToHexStr(&value);

Returns

Lowercase base-16 representation without a prefix.

Usage example (Cross-references)

Usage examples (Cross-references)
    }
    
    Str IntToHexStr(Int *value) {
        return IntToStrRadix(value, 16, false);
    }
        Int value   = IntFromBytesLE(bytes, sizeof(bytes));
        u64 written = IntToBytesLE(&value, out, sizeof(out));
        Str text    = IntToHexStr(&value);
    
        bool result = written == 4;
        Int value   = IntFromBytesBE(bytes, sizeof(bytes));
        u64 written = IntToBytesBE(&value, out, sizeof(out));
        Str text    = IntToHexStr(&value);
    
        bool result = written == 4;
        const char *hex   = "deadbeefcafebabe1234";
        Int         value = IntFromHexStr(hex);
        Str         text  = IntToHexStr(&value);
    
        bool result = strcmp(text.data, hex) == 0;
        z = "deadbeefcafebabe1234";
        StrReadFmt(z, "{x}", hex);
        hex_text = IntToHexStr(&hex);
        success  = success && (ZstrCompare(hex_text.data, "deadbeefcafebabe1234") == 0);
Last updated on