Download

Any way to convert an int or a float to hexadecimal?

Hello!
Any way to convert an int or a float to hexadecimal? In blueprint of course :slight_smile:

Yes there is. You just have to implement it.

Could you please show me how?

Here is an ugly direct implementation of the algorithm.

The function (input: integer; output: string):

](filedata/fetch?id=1785697&d=1594216431)

The macro *GetHexDigit *to map {1,2,…,15} → {1,2,…,F}:

](filedata/fetch?id=1785695&d=1594215978)

Usage:

3.jpg](filedata/fetch?id=1785694&d=1594215978)

Result:

123456789 -> 75BCD15

Note that the previous solution doesn’t have input validation, so you still need to check for 0 and negative numbers.

Thanks! Maybe because the whole data on tick or maybe not, but I copied Your code and on print I see infinite lines every second.
For example if I put in 15 for the integer input, the printed output comes out every frame like this:
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF…
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF…
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF…
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF…

I think maybe somewhere need to put in a doOnce, or maybe the while loop isn’t precise enough? Just thinking…

It’s working just fine for me:

](filedata/fetch?id=1785732&d=1594223246)

2.jpg](filedata/fetch?id=1785731&d=1594223246)

How are you using it?

Can you show me your Int2Hex function?



On second picture I have the flow from Tick (because the integer comes from tick), and I have an append function because The format needs to be [A"numbers"]

One little detail, the variables: Result and Temp must be local. Are yours local? If they are not, then, the result will always append to the previous one, resulting in an ever growing string.

So, make sure they are local, or set Result to empty at the beginning of the function.

Works for me, thank you! :cool: