String to int Conversion

Had to work around this and just get resolution I need from the array of fullscreen resolutions.

So basically not to use the conversion to numbers if String is converted from Formated Text, because Format Text outputs a dressed string, which has commas in it. (Internally it was something like “1,280”, not “1280”).

Did you connect all the values right? Here’s what I have and it works:

So, for some reason, when I’m trying to convert String value to Int value, last part of the number just dissapears.

I am trying to get resolution from UI. It’s a Text formated as “{Width}x{Height}” (for example “1280x720”). I then convert it to string (it’s still “1280x720”), then I use Split node to split the string into two separate strings at the “x” (it returns two strings “1280” and “720”). Everything fine thus far. Then I use ToInt node, to convert both strings to integers and here’s the problem: for some reason the first string only converts to the first digit of the number, while the second one converts fine. So I have the outputs of 1 and 720, instead of 1280 and 720.

Why is this happening and what do I do?

It works with Text To String, and Split works too, and that’s a lot easier, in fact. Thank you! I didn’t know about the Split node.

I used Split not a substring. Also, try converting from Text to String and then do your function. Does it still work? Anyway I found what works for me and probably even better.

Then does it work after Format Text node?

That’s all written in my question and I speculate, the problem is with dressed strings.

I explain the problem in my answer above. Thanks for trying to help anyway.

Incase it helps anyone else… I had a the same problem. It turned out (like [TRI99ER_) my numbers were coming from a Widget Input Text field which was adding a comma to any number over 999. (so I was getting “1,280”) When I then converted the text to a string, then to a Value, I just got the first part of the number, ie just the 1. If the number is less than 999, it works perfectly. I had to use the blueprint shown above just to strip out the “,” for any number over 999 first. Thanks Tuerer!

I spent a lot of time trying to work out if I could have just a simple widget “numeric” input field that wouldn’t do this, but I never found one. Even if you choose “numeric” in the fields details.