Ascii Int to Char

Is there a way to convert an integer ascii value to a char?

I am trying to turn an integer that will be 0 to 35 to a single number/letter. My current thinking is to say if the int is less than 10, convert the integer directly to a string (to get “0” to"9"). Then, if the int is 10 or greater, add 55 and convert it to a string using ascii, so 10 would be A, 11 would be B, etc…

Just use the int as an offset into an array or the alphabet :slight_smile:

You can just use FString::Chr(N). You can write something like this:

int Inp = … ;
int Index = Inp < 10? Inp + 48: Inp + 55;
FString Res = FString::Chr(Index);
...

I have found a solution, but it is not very elegant at all (switch on int, set a string variable). There isn’t a node that does this?

I doubt that there is such a node in the blueprints, since they don’t even have a char type. So I think that a direct solution can only be implemented in C++.

In blueprints you can use ClockworkOcean’s idea, for example you could do something like this:

2 Likes

That’s an interesting solution and its even easier than what I was originally planning and certianly better than my current approach. I would not have gotten that from ClockworkOcean’s idea. I thought he meant make a string array of the characters I needed.