Download

String to int behavior for non-numeric strings

I’m using an editable text box to allow the user to enter a numeric value that I will use later. I have a Editable Text Box - > Text to String - > String to Int. My concern is that if a user enters a value that cannot be converted to an int (alpha charcarcters), I’m not sure what the behavior will be. The documentation for the String to Int function is pretty barebones and doesn’t explain that case (String To Int | Unreal Engine Documentation). I’m new to UE4 so go easy on me! I tried to see the C++ code but my UE4 installation must not be set up properly because clicking the “Go To Definition” button doesn’t do anything for me.

Any guidance on how to use BP scripting to check if a string from an editable text box is in fact being properly converted to an integer would be appreciated!

I did some more debugging on my own and found that if a string fails to convert to an integer, it simply returns 0. Hopefully that helps anyone else in future.