I would like to have my visible label text broken, which is too long. enter image description here

I found some solution here:

How to split text attribute by characters in QGIS?

but applying the expression to my example:

  left( "Text", strpos( "Text" ,'-'))

I am getting only B3-, whereas another part of the text is gone. I need the visible label like this:


instead of

B3-24F DP&\PSP2

How can I do it?

2 Answers 2


Your expression does exactly what it is supposed to be doing. I guess you mixed up the terms "split" and "wrap".

Go to your label properties and navigate to "formatting". Then fill "wrap on character" with -:

enter image description here

Also check out the other options available there ;)


The labels displayed in your map, and the labels displayed in the text of your question are different. The labels in the map shows B3- 24F DP & \PSP2, and the labels in the text of your question shows B3-24F DP&\PSP2. The former text contains more spaces compared with the latter text.

Anyway whatever the case, you need to use Wrap lines to and specify the number of characters you want, and then choose Minimum line length in the drop-down menu.

In this example, I used 6 characters. Here is the settings, and the final output:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.