Count lines of text in a label

Hi there,
Does anyone know of a way to determine (count) how many lines of text are in a label - I’m not talking about counting letters in a label, just how many lines are in a label so that I can add some padding and keep all labels uniform in length or height.
Thanks in advance.
MMB.

You can split text at \n (new line char), then get size of it:
image

4 Likes

Thanks Hossein, would this work where text (in a label), spills over to create a new line without ‘manualy’ entering the \n carriage return?
Thanks again.
MMB

@mmb_917 No there is no way that it would work like that because that would be counted as single line not multiple lines. For example, try having the label as “fill parent”, set text into label, then change phone orientation to landscape. You’ll see that more text will be displayed on first line of label.

How to set automatic serial number every line break