For example, I have a string with 20 words length. I set a text widget in UMG and I want to show 10 words in a line and show the rest in another line. I know there is a function in STRING named “Split” but I don’t know how to use it to set the length limitation of each line. Can anyone help me? .)
You can use a “magic word” as a text splitter…
In this example, the “magic word” is “XYZ” I attached between the withespace after the last word of Line1 and before the first word of Line2.
I’ve done this using parse into array with the delimiter as a space. This gives you an array of all the words in your string. You can then do a for each loop on this to create a string adding each word until the string length hits a maximum value, then start a new line - the best way to do this is have another string array with an element for each line of text. Don’t forget to add the spaces back in!