Substring automatically removes whitespace characters

I’m having a problem with a substring of 7 characters .

The Substring is " X" => "seven whitespace characters & X"
but returns "X "

It’s like it’s automatically trimmed ?
Justification is centredLeft , but this shouldn’t remove the whitespace characters ?

Ok, I think I forgot to intitialize the string with whitespace characters :wink:

Hmmm, the setText seems to remove whitespace characters till it finds a character ?

When I use tnewstring = newstring.replaceCharacter(' ','.') ; I’m getting something like “…N” but when not just “N” , and the label needs to retain the original position of the single characer … any solution for this ?

To give some extra information what I’m trying to do : The label is actually the visualisation of 7 digits from a 7 segment display . 3 whitespaces and a normal letter place that letter in the middle . 6 whitespaces and a letter is the last digit … but the setText seems to ignore those whitespaces

This has nothing to do with strings or setText… The label may choose to ignore the whitespace when it justifies the text onscreen, I don’t remember exactly. If you want more precise control over your layout, you’d probably be better off just drawing the text yourself, rather than using a label.

A monospaced font is doing the trick (never heard of that before untill this morning :oops: )