Get number of Lines in 'Text' Widget - Function

Hello, i think title speak for itself. Function must show number of lines in ‘Text’ Widget, for multi-line or single-line.
This function will be very useful for safe and easy transfer text from page to page for example.
Please, dear Epic Games :slight_smile:

You can simply convert to string and split by "
" into an array then count elements in array.

Does that actually work? Like if you put in a large paragraph and have the box set to autowrap, will the string conversion actually have the
's in there?

Nope. You cant use this “solution” with several localizations, autowrap etc. Line Counter should be a built in function.

If Epic implement that function it would do exactly the same thing.
Count line breaks and return a number.

text wrapping is not line break.

Well there should be an easy way to count lines from a wrapped textbox. Where basically, you’d just access a variable for it and it would spit out an integer.

But why? Shouldn’t be text auto-wrapped separately in the next widget?

EDIT: I started over with my explanation. What I’m referring to is for textblocks and not textboxes, but you could implement some kind of similar method for textboxes that you type into.

-Big wall text needs to be put inside small textblock that has autowrap enabled
-You want to break up the wall of text into “pages” that will fill the block
-Based on the current font settings, you need to know how many lines you can fit in there

So what I propose is some kind of function that looks like the following:

Inputs:
-Text trying to be fit into block
-Which textblock
-Possibly have inputs for font settings like if you were getting ready to display with different font settings?

Outputs:
-Boolean that outputs true if it fits, false if it doesn’t
-Integer that outputs how many lines fit
-Text portion that fits into the textblock
-Remainder of the text that doesn’t fit?

Though I suppose if it has this kind of carry over output like this, you wouldn’t really need it to output the number of lines, but it still might be useful for something…