Can you remove words from a string?

So I want to get the “setres 1920x1080” and just get the “1920x1080” part out of it to set the default selection in the dropdown box in UMG.

How do I need to format the text to remove that part?

if the bit that you want is on the end or at the beginning you can call

FString unwantedBit = TEXT("setres ");
resolutionString->RemoveFromStart(unwantedBit);

Hope this helps

Kieran

I am using blueprint as my tag says, and I posted this under blueprinting ^^ I have no clue how to program.

Can I put code like that into a blueprint to use it or is that a bit hard? Plus I imagine doing so in blueprint would be hard.

you may have to make a blueprint node for it which may not be hard as there are tutorials, or you can try and look for a blueprint equivalent

string input that says “setres (any resolution set by player)” and then it is going into another string variable but without “setres” so I can more easily recall the last set resolution that was saved to disk.

I directly save the graphics commands to disk so I can just load them up and run the same commands. Its a bit easier for the other options that only have 4 different options. But my resolutions have 79 options.

This is how I check for what AA is chosen:
And this is how I set which resolution is chosen: “ResolutionString” don’t have the “setres” because you get the direct string from the combobox selection. So I use formating to put “setres” on front of the string

So basically I am saving commands directly, and then running them again at startup. But since the “selected option” in a Combo box has to be the same name as what will be displayed, I need to cut off the command part of the saved commands. Which is a simple string. The selected variable here can’t have the command part still in the string.

Can you elaborate? How are you wanting to get the text? An outputted string?

it would be more efficient to store the data without the "setres " in the first place, then only append that text when calling the consoleCommand.

Try this (Parse into Array) with a blank Delimiter:

“setres 1920x1080” will be devided into “setres” at index 0 and “1920x1080” at index 1.

The print and appends were just for me testing.

http://puu.sh/d3kBd/ff552728ab.png

1 Like

Agree with Onmicypher in this case. But if you do need to cut words and know how many letters, drag off the string and try RightChop, in this case with an index of 7.

Yeah I don’t know why I had the mentality of absolutely needing the “setres” when saving. I guess I was stuck in the “I don’t want to set up a system for checking close to 80 different resolutions with blueprints, so I don’t want to try to think about how do do it” At least I learned what I came here to ask for :slight_smile: I should have searched trough the string Utilities before text utilities, because I couldn’t find anything similar under text.

The more one know the better.

You can just split then append the ends, whatever you split on will be removed :slight_smile:

You can use Replace into empty

You can use a “split” node to split the string into “setres” and “1920x1080”